[llvm] r343256 - [ORC] LastKey needs to be protected to prevent data races.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 27 12:27:20 PDT 2018


Author: lhames
Date: Thu Sep 27 12:27:20 2018
New Revision: 343256

URL: http://llvm.org/viewvc/llvm-project?rev=343256&view=rev
Log:
[ORC] LastKey needs to be protected to prevent data races.

Modified:
    llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h

Modified: llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h?rev=343256&r1=343255&r2=343256&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h (original)
+++ llvm/trunk/include/llvm/ExecutionEngine/Orc/Core.h Thu Sep 27 12:27:20 2018
@@ -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




More information about the llvm-commits mailing list