aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine
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
commita3ac0c105d26f8535d03031db7e97274b3ff8159 (patch)
tree65182115ed7ea6e335aaa1083bf7b01b12958894 /lib/ExecutionEngine
parent4b56f96bc60ca8cbd0daf74118484af99c591f91 (diff)
downloadexternal_llvm-a3ac0c105d26f8535d03031db7e97274b3ff8159.zip
external_llvm-a3ac0c105d26f8535d03031db7e97274b3ff8159.tar.gz
external_llvm-a3ac0c105d26f8535d03031db7e97274b3ff8159.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64997 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/ExecutionEngine')
-rw-r--r--lib/ExecutionEngine/JIT/JIT.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ExecutionEngine/JIT/JIT.cpp b/lib/ExecutionEngine/JIT/JIT.cpp
index 6940d85..0f98ddc 100644
--- a/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/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);