diff options
author | Lang Hames <lhames@gmail.com> | 2018-10-16 20:13:06 +0000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2018-10-16 20:13:06 +0000 |
commit | 8b94274f22d8c346103c5682e7899e8b43db16d7 (patch) | |
tree | ab087f3142915bbc8d445561570f4ee30385227d /llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp | |
parent | 4084df00402bc9b69b15b56cbdd8f5f8be81cc0a (diff) | |
download | bcm5719-llvm-8b94274f22d8c346103c5682e7899e8b43db16d7.tar.gz bcm5719-llvm-8b94274f22d8c346103c5682e7899e8b43db16d7.zip |
[ORC] Make the VModuleKey optional, propagate it via MaterializationUnit and
MaterializationResponsibility.
VModuleKeys are intended to enable selective removal of modules from a JIT
session, however for a wide variety of use cases selective removal is not
needed and introduces unnecessary overhead. As of this commit, the default
constructed VModuleKey value is reserved as a "do not track" value, and
becomes the default when adding a new module to the JIT.
This commit also changes the propagation of VModuleKeys. They were passed
alongside the MaterializationResponsibity instance in XXLayer::emit methods,
but are now propagated as part of the MaterializationResponsibility instance
itself (and as part of MaterializationUnit when stored in a JITDylib).
Associating VModuleKeys with MaterializationUnits in this way should allow
for a thread-safe module removal mechanism in the future, even when a module
is in the process of being compiled, by having the
MaterializationResponsibility object check in on its VModuleKey's state
before commiting its results to the JITDylib.
llvm-svn: 344643
Diffstat (limited to 'llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp')
-rw-r--r-- | llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp index 6d029e16ba9..d952d1be70d 100644 --- a/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp +++ b/llvm/lib/ExecutionEngine/Orc/IRCompileLayer.cpp @@ -21,19 +21,19 @@ void IRCompileLayer::setNotifyCompiled(NotifyCompiledFunction NotifyCompiled) { this->NotifyCompiled = std::move(NotifyCompiled); } -void IRCompileLayer::emit(MaterializationResponsibility R, VModuleKey K, - ThreadSafeModule TSM) { +void IRCompileLayer::emit(MaterializationResponsibility R, + ThreadSafeModule TSM) { assert(TSM.getModule() && "Module must not be null"); if (auto Obj = Compile(*TSM.getModule())) { { std::lock_guard<std::mutex> Lock(IRLayerMutex); if (NotifyCompiled) - NotifyCompiled(K, std::move(TSM)); + NotifyCompiled(R.getVModuleKey(), std::move(TSM)); else TSM = ThreadSafeModule(); } - BaseLayer.emit(std::move(R), std::move(K), std::move(*Obj)); + BaseLayer.emit(std::move(R), std::move(*Obj)); } else { R.failMaterialization(); getExecutionSession().reportError(Obj.takeError()); |