Fix JIT on separate thread
When JIT_IN_SEPARATE_THREAD is defined we generate Reactor routines on
LLVM in a new thread. With Variable::unmaterializedVariables now a
thread-local pointer, we have to avoid touching it from the separate
thread. This is accomplished by moving the createRet() call out of the
lambda which gets called on the separate thread.
Note that while the 'jit' object is no longer needed after
acquireRoutine(), that method may not be called since one may return
early from Reactor code generation. Its deletion was removed from
acquireRoutine() since Nucleus destruction follows quickly after and
this keeps the object's explicit lifetime management simple.
Note also that 'Variable' objects may still exist after acquireRoutine()
has been called, so the earliest we can delete the set of unmaterialized
variables is still at Nucleus object destruction when Function<> is
destructed.
Bug: b/153803432
Bug: b/149829034
Change-Id: Ic3940e5c52a3009e48fb1e1ff6137db6fd5ca96b
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/44488
Presubmit-Ready: Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Tested-by:
Nicolas Capens <nicolascapens@google.com>
Reviewed-by:
Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment