summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-19 02:40:15 +0000
committerDan Gohman <gohman@apple.com>2009-02-19 02:40:15 +0000
commit6c109b497971b9cbd3a66b266708bf0b0b5699ea (patch)
treed256ffc0b7675d6d77ef29dd09b919fb56e70f54 /llvm/lib
parent5d2534ada7b523ca603bfc543f6b3358e69aeab4 (diff)
downloadbcm5719-llvm-6c109b497971b9cbd3a66b266708bf0b0b5699ea.tar.gz
bcm5719-llvm-6c109b497971b9cbd3a66b266708bf0b0b5699ea.zip
Reapply r57340. VMKit does not presently rely on materializeFunction
being called with the lock released, and this fixes a race condition in the JIT as used by lli. llvm-svn: 64997
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 6940d85d757..0f98ddcabb3 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -553,6 +553,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.
@@ -578,8 +580,6 @@ void *JIT::getPointerToFunction(Function *F) {
return Addr;
}
- MutexGuard locked(lock);
-
if (F->isDeclaration()) {
bool AbortOnFailure = F->getLinkage() != GlobalValue::ExternalWeakLinkage;
void *Addr = getPointerToNamedFunction(F->getName(), AbortOnFailure);
OpenPOWER on IntegriCloud