<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 29, 2017 at 1:04 PM Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Dave,<div><br></div><div>Isn't that what the proposed patch is doing? The pointers were already shared.</div></div></blockquote><div><br>Ah, yeah - I misread the patch, saw lines that added shared_ptrs and thought the ownership was being changed.<br><br>Nevermind, carry on.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>(Side note: The ShouldDelete nonsense is there because of MCJIT's absurd ownership semantics addModule takes a unique_ptr, but removeModule releases it rather than deleting it.)</div><div><br></div><div>Cheers,</div><div>Lang.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 28, 2017 at 8:27 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Could the member variables be reordered instead? Placing ShouldDelete before LazyEmitLayer?<br><br>That seems simpler/better (less complicated ownership, etc) than moving to shared ownership?<br><br><div class="gmail_quote"><div><div class="m_-2289223696886389723h5"><div dir="ltr">On Fri, Aug 18, 2017 at 11:41 AM Moritz Kroll via Phabricator via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-2289223696886389723h5">mkroll-nv created this revision.<br>
<br>
When an OrcMCJITReplacement object gets destructed, LazyEmitLayer may still contain a shared_ptr of a module, which requires ShouldDelete in the deleter.<br>
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.<br>
Changing the order of declaration fixes this.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D36888" rel="noreferrer" target="_blank">https://reviews.llvm.org/D36888</a><br>
<br>
Files:<br>
lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br>
<br>
<br>
Index: lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br>
===================================================================<br>
--- lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br>
+++ lib/ExecutionEngine/Orc/OrcMCJITReplacement.h<br>
@@ -381,6 +381,9 @@<br>
std::shared_ptr<JITSymbolResolver> ClientResolver;<br>
Mangler Mang;<br>
<br>
+ std::map<Module*, bool> ShouldDelete;<br>
+ std::vector<std::shared_ptr<Module>> LocalModules;<br>
+<br>
NotifyObjectLoadedT NotifyObjectLoaded;<br>
NotifyFinalizedT NotifyFinalized;<br>
<br>
@@ -402,8 +405,6 @@<br>
std::map<ObjectLayerT::ObjHandleT, SectionAddrSet, ObjHandleCompare><br>
UnfinalizedSections;<br>
<br>
- std::map<Module*, bool> ShouldDelete;<br>
- std::vector<std::shared_ptr<Module>> LocalModules;<br>
std::vector<object::OwningBinary<object::Archive>> Archives;<br>
};<br>
<br>
<br>
<br></div></div>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div></div>
</blockquote></div><br></div>
</blockquote></div></div>