aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 281869a..9e89e3c 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -301,7 +301,6 @@ void JIT::runJITOnFunction(Function *F) {
/// specified function, compiling it if neccesary.
///
void *JIT::getPointerToFunction(Function *F) {
- MutexGuard locked(lock);
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr; // Check if function already code gen'd
@@ -326,7 +325,13 @@ void *JIT::getPointerToFunction(Function *F) {
abort();
}
}
+
+ if (void *Addr = getPointerToGlobalIfAvailable(F)) {
+ return Addr;
+ }
+ MutexGuard locked(lock);
+
if (F->isDeclaration()) {
void *Addr = getPointerToNamedFunction(F->getName());
addGlobalMapping(F, Addr);