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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Fri Jun 12 07:11:12 PDT 2009


Author: geoffray
Date: Fri Jun 12 09:11:08 2009
New Revision: 73227

URL: http://llvm.org/viewvc/llvm-project?rev=73227&view=rev
Log:
After obtaining the lock, look if the function has been codegen'd by
another thread.


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=73227&r1=73226&r2=73227&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Fri Jun 12 09:11:08 2009
@@ -563,6 +563,11 @@
     return Addr;   // Check if function already code gen'd
 
   MutexGuard locked(lock);
+  
+  // Now that this thread owns the lock, check if another thread has already
+  // code gen'd the function.
+  if (void *Addr = getPointerToGlobalIfAvailable(F))
+    return Addr;  
 
   // Make sure we read in the function if it exists in this Module.
   if (F->hasNotBeenReadFromBitcode()) {





More information about the llvm-commits mailing list