[llvm] 1ea8d12 - [ORC] Add missing lock to CompileOnDemandLayer::getPerDylibResources.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 26 18:37:02 PDT 2021
Author: Lang Hames
Date: 2021-09-26T18:35:58-07:00
New Revision: 1ea8d12510b9e1b208a7541c86e1b02a9a3db0e2
URL: https://github.com/llvm/llvm-project/commit/1ea8d12510b9e1b208a7541c86e1b02a9a3db0e2
DIFF: https://github.com/llvm/llvm-project/commit/1ea8d12510b9e1b208a7541c86e1b02a9a3db0e2.diff
LOG: [ORC] Add missing lock to CompileOnDemandLayer::getPerDylibResources.
The getPerDylibResources method may be called concurrently from multiple
threads, so we need to protect access to the underlying map.
Possible for fix https://llvm.org/PR51064
Added:
Modified:
llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
index 5b73c0e2fbc8..9ff6cec8c6c5 100644
--- a/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp
@@ -184,6 +184,8 @@ void CompileOnDemandLayer::emit(
CompileOnDemandLayer::PerDylibResources &
CompileOnDemandLayer::getPerDylibResources(JITDylib &TargetD) {
+ std::lock_guard<std::mutex> Lock(CODLayerMutex);
+
auto I = DylibResources.find(&TargetD);
if (I == DylibResources.end()) {
auto &ImplD =
More information about the llvm-commits
mailing list