[ORC] LastKey needs to be protected to prevent data races.
authorLang Hames <lhames@gmail.com>
Thu, 27 Sep 2018 19:27:20 +0000 (19:27 +0000)
committerLang Hames <lhames@gmail.com>
Thu, 27 Sep 2018 19:27:20 +0000 (19:27 +0000)
llvm-svn: 343256

llvm/include/llvm/ExecutionEngine/Orc/Core.h

index f757057..6f6bd2e 100644 (file)
@@ -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