diff options
| author | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2009-06-12 14:11:08 +0000 |
|---|---|---|
| committer | Nicolas Geoffray <nicolas.geoffray@lip6.fr> | 2009-06-12 14:11:08 +0000 |
| commit | b1a909129814a83af60ac800d2a91f339b97620e (patch) | |
| tree | fc294612614b58323d00eb33768cd97d82a7956f /llvm/lib/ExecutionEngine/JIT | |
| parent | 42ded7042c1a14403aca3d8b4419e60bcc0e51ea (diff) | |
| download | bcm5719-llvm-b1a909129814a83af60ac800d2a91f339b97620e.tar.gz bcm5719-llvm-b1a909129814a83af60ac800d2a91f339b97620e.zip | |
After obtaining the lock, look if the function has been codegen'd by
another thread.
llvm-svn: 73227
Diffstat (limited to 'llvm/lib/ExecutionEngine/JIT')
| -rw-r--r-- | llvm/lib/ExecutionEngine/JIT/JIT.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp index f8ae8844616..43995cb0ecd 100644 --- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp +++ b/llvm/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()) { |

