From: Nicolas Geoffray Date: Fri, 12 Jun 2009 14:11:08 +0000 (+0000) Subject: After obtaining the lock, look if the function has been codegen'd by X-Git-Tag: android-x86-6.0-r1~1003^2~20073 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e91208c9631c98abbdce19ca7b1f51d9241faa18;p=android-x86%2Fexternal-llvm.git 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 --- diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index f8ae8844616..43995cb0ecd 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()) {