This is an archive of the discontinued LLVM Phabricator instance.

[ORC] Fix crash in ~OrcMCJITReplacement when modules are not removed.
ClosedPublic

Authored by mkroll-nv on Aug 18 2017, 11:40 AM.

Details

Reviewers
lhames
Summary

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.

Diff Detail

Event Timeline

mkroll-nv created this revision.Aug 18 2017, 11:40 AM
lhames accepted this revision.Aug 24 2017, 11:59 AM

Looks good to me. Thanks!

Do you have commit access? If not I can commit it for you.

This revision is now accepted and ready to land.Aug 24 2017, 11:59 AM

Thanks for reviewing!

No, I don't have commit access, please commit it for me.

lhames closed this revision.Aug 29 2017, 5:49 PM

Committed in r312086. Thanks Moritz!