[PATCH] D36888: [ORC] Fix crash in ~OrcMCJITReplacement when modules are not removed.
Moritz Kroll via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 18 11:41:00 PDT 2017
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;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36888.111714.patch
Type: text/x-patch
Size: 780 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170818/0397e49b/attachment.bin>
More information about the llvm-commits
mailing list