aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-06 21:25:08 +0000
committerDan Gohman <gohman@apple.com>2009-02-06 21:25:08 +0000
commit21afcda54479602c2936946731a3f1ee8e5d2322 (patch)
tree9f0ec80a431a987a03052cd555ae6123fc0a5d25 /lib
parente98fc32b0d80663aff215e328bcd297b3141b565 (diff)
downloadexternal_llvm-21afcda54479602c2936946731a3f1ee8e5d2322.zip
external_llvm-21afcda54479602c2936946731a3f1ee8e5d2322.tar.gz
external_llvm-21afcda54479602c2936946731a3f1ee8e5d2322.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63965 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp9
-rw-r--r--lib/ExecutionEngine/JIT/JIT.h5
2 files changed, 9 insertions, 5 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 9595099..008c590 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/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/lib/ExecutionEngine/JIT/JIT.h b/lib/ExecutionEngine/JIT/JIT.h
index 7c085e3..395e049 100644
--- a/lib/ExecutionEngine/JIT/JIT.h
+++ b/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.