[llvm] r312086 - [Orc] Fix member variable ordering issue in OrcMCJITReplacement.

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 29 19:13:17 PDT 2017


Clear comment?  Test case?


On 08/29/2017 05:47 PM, Lang Hames via llvm-commits wrote:
> Author: lhames
> Date: Tue Aug 29 17:47:42 2017
> New Revision: 312086
>
> URL: http://llvm.org/viewvc/llvm-project?rev=312086&view=rev
> Log:
> [Orc] Fix member variable ordering issue in OrcMCJITReplacement.
>
> https://reviews.llvm.org/D36888
>
>  From that review description:
>
> When an OrcMCJITReplacement object gets destructed, LazyEmitLayer may still
> contain a shared_ptr of a module, which requires ShouldDelete in the deleter.
> But ShouldDelete gets destructed before LazyEmitLayer due to the order of
> declaration in OrcMCJITReplacement, which leads to a crash, when the destructor
> of LazyEmitLayer is executed.  Changing the order of declaration fixes this.
>
> Patch by Moritz Kroll. Thanks Moritz!
>
>
> Modified:
>      llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
>
> Modified: llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h?rev=312086&r1=312085&r2=312086&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h (original)
> +++ llvm/trunk/lib/ExecutionEngine/Orc/OrcMCJITReplacement.h Tue Aug 29 17:47:42 2017
> @@ -381,6 +381,9 @@ private:
>     std::shared_ptr<JITSymbolResolver> ClientResolver;
>     Mangler Mang;
>   
> +  std::map<Module*, bool> ShouldDelete;
> +  std::vector<std::shared_ptr<Module>> LocalModules;
> +
>     NotifyObjectLoadedT NotifyObjectLoaded;
>     NotifyFinalizedT NotifyFinalized;
>   
> @@ -402,8 +405,6 @@ private:
>     std::map<ObjectLayerT::ObjHandleT, SectionAddrSet, ObjHandleCompare>
>         UnfinalizedSections;
>   
> -  std::map<Module*, bool> ShouldDelete;
> -  std::vector<std::shared_ptr<Module>> LocalModules;
>     std::vector<object::OwningBinary<object::Archive>> Archives;
>   };
>   
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list