[llvm-commits] [llvm] r64997 - /llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp

Dan Gohman gohman at apple.com
Wed Feb 18 18:40:17 PST 2009


Author: djg
Date: Wed Feb 18 20:40:15 2009
New Revision: 64997

URL: http://llvm.org/viewvc/llvm-project?rev=64997&view=rev
Log:
Reapply r57340. VMKit does not presently rely on materializeFunction
being called with the lock released, and this fixes a race condition
in the JIT as used by lli.

Modified:
    llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp?rev=64997&r1=64996&r2=64997&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Wed Feb 18 20:40:15 2009
@@ -553,6 +553,8 @@
   if (void *Addr = getPointerToGlobalIfAvailable(F))
     return Addr;   // Check if function already code gen'd
 
+  MutexGuard locked(lock);
+
   // Make sure we read in the function if it exists in this Module.
   if (F->hasNotBeenReadFromBitcode()) {
     // Determine the module provider this function is provided by.
@@ -578,8 +580,6 @@
       return Addr;
   }
 
-  MutexGuard locked(lock);
-
   if (F->isDeclaration()) {
     bool AbortOnFailure = F->getLinkage() != GlobalValue::ExternalWeakLinkage;
     void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);





More information about the llvm-commits mailing list