From 3ac3c0d717c64365c5e55a003f67e9b2460fd660 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Thu, 27 Sep 2018 19:27:20 +0000 Subject: [PATCH] [ORC] LastKey needs to be protected to prevent data races. llvm-svn: 343256 --- llvm/include/llvm/ExecutionEngine/Orc/Core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index f757057..6f6bd2e 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -655,7 +655,9 @@ public: bool AddToMainDylibSearchOrder = true); /// Allocate a module key for a new module to add to the JIT. - VModuleKey allocateVModule() { return ++LastKey; } + VModuleKey allocateVModule() { + return runSessionLocked([this]() { return ++LastKey; }); + } /// Return a module key to the ExecutionSession so that it can be /// re-used. This should only be done once all resources associated -- 2.7.4