aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2009-06-12 14:11:08 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2009-06-12 14:11:08 +0000
commit81de4bfc3a1abb89e9b1db40733b4e88f42c4265 (patch)
tree12cec2380badb686b60ae2c412108cca88602350
parent4072d660745dabd5a3147c74caba8d77a623f32e (diff)
downloadexternal_llvm-81de4bfc3a1abb89e9b1db40733b4e88f42c4265.zip
external_llvm-81de4bfc3a1abb89e9b1db40733b4e88f42c4265.tar.gz
external_llvm-81de4bfc3a1abb89e9b1db40733b4e88f42c4265.tar.bz2
After obtaining the lock, look if the function has been codegen'd by
another thread. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73227 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index f8ae884..43995cb 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/lib/ExecutionEngine/JIT/JIT.cpp
@@ -563,6 +563,11 @@ void *JIT::getPointerToFunction(Function *F) {
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()) {