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 | e91208c9631c98abbdce19ca7b1f51d9241faa18 (patch) | |
tree | 12cec2380badb686b60ae2c412108cca88602350 | |
parent | f343b69f47192dc9d1479f8b14aadccd17820d90 (diff) |
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.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index f8ae884461..43995cb0ec 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()) { |