diff options
author | Mon P Wang <wangmp@apple.com> | 2008-10-10 01:47:42 +0000 |
---|---|---|
committer | Mon P Wang <wangmp@apple.com> | 2008-10-10 01:47:42 +0000 |
commit | 1c341c8462a208ccc5ba4b4e030cdc989ce38818 (patch) | |
tree | 693164f8cf1ea590932501a3577cd53bc3f16cc9 /lib/ExecutionEngine/JIT/JIT.cpp | |
parent | 5ca6bd14a00ba5310ce1a632d3a0cc8f8af31433 (diff) |
Moved guard mutex upwards to guard materializing a function
in getPointerToFunction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine/JIT/JIT.cpp')
-rw-r--r-- | lib/ExecutionEngine/JIT/JIT.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp index 383b380475..413308c3df 100644 --- a/lib/ExecutionEngine/JIT/JIT.cpp +++ b/lib/ExecutionEngine/JIT/JIT.cpp @@ -489,6 +489,8 @@ void *JIT::getPointerToFunction(Function *F) { if (void *Addr = getPointerToGlobalIfAvailable(F)) return Addr; // Check if function already code gen'd + MutexGuard locked(lock); + // Make sure we read in the function if it exists in this Module. if (F->hasNotBeenReadFromBitcode()) { // Determine the module provider this function is provided by. @@ -509,13 +511,11 @@ 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); |