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

Mon P Wang wangmp at apple.com
Thu Oct 9 18:47:42 PDT 2008


Author: wangmp
Date: Thu Oct  9 20:47:42 2008
New Revision: 57340

URL: http://llvm.org/viewvc/llvm-project?rev=57340&view=rev
Log:
Moved guard mutex upwards to guard materializing a function
in getPointerToFunction


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=57340&r1=57339&r2=57340&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Thu Oct  9 20:47:42 2008
@@ -489,6 +489,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.
@@ -509,13 +511,11 @@
       abort();
     }
   }
-  
+
   if (void *Addr = getPointerToGlobalIfAvailable(F)) {
     return Addr;
   }
 
-  MutexGuard locked(lock);
-  
   if (F->isDeclaration()) {
     void *Addr = getPointerToNamedFunction(F->getName());
     addGlobalMapping(F, Addr);





More information about the llvm-commits mailing list