diff options
| author | Dan Gohman <gohman@apple.com> | 2009-02-06 21:25:08 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-02-06 21:25:08 +0000 | 
| commit | 21cb4114fbfa1495e95e71b252b123fe16e72318 (patch) | |
| tree | 3825433d413990febf9df1418fc23762a0c7fad6 | |
| parent | 1b32e0bbc2db5d619636b544f4f6bae002c310f6 (diff) | |
| download | bcm5719-llvm-21cb4114fbfa1495e95e71b252b123fe16e72318.tar.gz bcm5719-llvm-21cb4114fbfa1495e95e71b252b123fe16e72318.zip | |
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.
llvm-svn: 63965
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.h | 5 | 
2 files changed, 9 insertions, 5 deletions
| diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index 9595099c3c0..008c5907d83 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp @@ -475,9 +475,12 @@ GenericValue JIT::runFunction(Function *F,  /// 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 @@ void *JIT::getPointerToFunction(Function *F) {      return Addr;    } -  runJITOnFunction(F); +  runJITOnFunctionUnlocked(F, locked);    void *Addr = getPointerToGlobalIfAvailable(F);    assert(Addr && "Code generation didn't add function to GlobalAddress table!"); diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.h b/llvm/lib/ExecutionEngine/JIT/JIT.h index 7c085e360e2..395e04926d2 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.h +++ b/llvm/lib/ExecutionEngine/JIT/JIT.h @@ -147,8 +147,9 @@ public:  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. | 

