[PATCH] D36888: [ORC] Fix crash in ~OrcMCJITReplacement when modules are not removed.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 20:27:45 PDT 2017


Could the member variables be reordered instead? Placing ShouldDelete
before LazyEmitLayer?

That seems simpler/better (less complicated ownership, etc) than moving to
shared ownership?

On Fri, Aug 18, 2017 at 11:41 AM Moritz Kroll via Phabricator via
llvm-commits <llvm-commits at lists.llvm.org> wrote:

> mkroll-nv created this revision.
>
> 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.
>
>
> https://reviews.llvm.org/D36888
>
> Files:
>   lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
>
>
> Index: lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> ===================================================================
> --- lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> +++ lib/ExecutionEngine/Orc/OrcMCJITReplacement.h
> @@ -381,6 +381,9 @@
>    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 @@
>    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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170829/70433991/attachment.html>


More information about the llvm-commits mailing list