Commit bb66fa41 by Antonio Maiorano Committed by Nicolas Capens

LLVMJIT: fix asserts in latest LLVM

Make sure session is initialized before it is used by objectLayer. Fixes assert related to objectLayer using an invalid std::recursive_mutex in the session instance. Also added an explicit resource removal to fix assert in ~RTDyldObjectLinkingLayer(). Bug: b/171402030 Change-Id: I4f628a9ed4afd0126462858f8f0e3e42f90e21b3 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/49508 Kokoro-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 268fd732
......@@ -484,11 +484,11 @@ auto &Unwrap(T &&v)
// settings and no Reactor routine directly links against another.
class JITRoutine : public rr::Routine
{
llvm::orc::ExecutionSession session;
llvm::orc::RTDyldObjectLinkingLayer objectLayer;
llvm::orc::IRCompileLayer compileLayer;
llvm::orc::MangleAndInterner mangle;
llvm::orc::ThreadSafeContext ctx;
llvm::orc::ExecutionSession session;
llvm::orc::JITDylib &dylib;
std::vector<const void *> addresses;
......@@ -564,6 +564,15 @@ public:
}
}
~JITRoutine()
{
// TODO(b/165000222): Unconditional after LLVM 11 upgrade
#if LLVM_VERSION_MAJOR >= 11
// Avoid assert in ~RTDyldObjectLinkingLayer()
dylib.getDefaultResourceTracker()->remove();
#endif
}
const void *getEntry(int index) const override
{
return addresses[index];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment