summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine
diff options
context:
space:
mode:
authorNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-20 08:33:02 +0000
committerNicolas Geoffray <nicolas.geoffray@lip6.fr>2008-04-20 08:33:02 +0000
commit568f9818f77a11fe8f285c026a9bef5f3de0d843 (patch)
treedd9a3cdc87d0ffe1d48d41d718c747fb09fbc57d /llvm/lib/ExecutionEngine
parent8e8d498d34744e90ef02d0ccd01576a95aab46c9 (diff)
downloadbcm5719-llvm-568f9818f77a11fe8f285c026a9bef5f3de0d843.tar.gz
bcm5719-llvm-568f9818f77a11fe8f285c026a9bef5f3de0d843.zip
Do not hold the JIT lock when materializing a function and verify if the
function has already been codegen'd. This is required by the Java class loading mechanism which executes Java code when materializing a function. llvm-svn: 49988
Diffstat (limited to 'llvm/lib/ExecutionEngine')
-rw-r--r--llvm/lib/ExecutionEngine/JIT/JIT.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/ExecutionEngine/JIT/JIT.cpp b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
index 281869ad1bf..9e89e3c0e1d 100644
--- a/llvm/lib/ExecutionEngine/JIT/JIT.cpp
+++ b/llvm/lib/ExecutionEngine/JIT/JIT.cpp
@@ -301,7 +301,6 @@ void JIT::runJITOnFunction(Function *F) {
/// specified function, compiling it if neccesary.
///
void *JIT::getPointerToFunction(Function *F) {
- MutexGuard locked(lock);
if (void *Addr = getPointerToGlobalIfAvailable(F))
return Addr; // Check if function already code gen'd
@@ -326,7 +325,13 @@ 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);
OpenPOWER on IntegriCloud