[llvm-commits] [llvm] r63965 - in /llvm/trunk/lib/ExecutionEngine/JIT: JIT.cpp JIT.h

Dan Gohman gohman at apple.com
Fri Feb 6 13:25:09 PST 2009


Author: djg
Date: Fri Feb  6 15:25:08 2009
New Revision: 63965

URL: http://llvm.org/viewvc/llvm-project?rev=63965&view=rev
Log:
Split the locking out of JIT::runJITOnFunction so that callers
that already hold the lock can call an entry point that doesn't
re-acquire the lock.

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

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

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.cpp Fri Feb  6 15:25:08 2009
@@ -475,9 +475,12 @@
 /// GlobalAddress[F] with the address of F's machine code.
 ///
 void JIT::runJITOnFunction(Function *F) {
-  static bool isAlreadyCodeGenerating = false;
-
   MutexGuard locked(lock);
+  runJITOnFunctionUnlocked(F, locked);
+}
+
+void JIT::runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked) {
+  static bool isAlreadyCodeGenerating = false;
   assert(!isAlreadyCodeGenerating && "Error: Recursive compilation detected!");
 
   // JIT the function
@@ -537,7 +540,7 @@
     return Addr;
   }
 
-  runJITOnFunction(F);
+  runJITOnFunctionUnlocked(F, locked);
 
   void *Addr = getPointerToGlobalIfAvailable(F);
   assert(Addr && "Code generation didn't add function to GlobalAddress table!");

Modified: llvm/trunk/lib/ExecutionEngine/JIT/JIT.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JIT.h?rev=63965&r1=63964&r2=63965&view=diff

==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JIT.h (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JIT.h Fri Feb  6 15:25:08 2009
@@ -147,8 +147,9 @@
   
 private:
   static MachineCodeEmitter *createEmitter(JIT &J, JITMemoryManager *JMM);
-  void runJITOnFunction (Function *F);
-  
+  void runJITOnFunction(Function *F);
+  void runJITOnFunctionUnlocked(Function *F, const MutexGuard &locked);
+
 protected:
 
   /// getMemoryforGV - Allocate memory for a global variable.





More information about the llvm-commits mailing list