[llvm-commits] [vmkit] r51253 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaJIT.cpp JnjvmModuleProvider.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon May 19 08:33:33 PDT 2008
Author: geoffray
Date: Mon May 19 10:33:32 2008
New Revision: 51253
URL: http://llvm.org/viewvc/llvm-project?rev=51253&view=rev
Log:
Take the JIT lock when mapping JVM bytecode to LLVM IR.
The lock is released when loading exception classes and acquired
again just after.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=51253&r1=51252&r2=51253&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon May 19 10:33:32 2008
@@ -818,7 +818,11 @@
}
}
}
-
+
+ // We don't need the lock here, and Java requires to load the classes in the
+ // try clause, which may require compilation. Therefore we release the lock
+ // and aquire it after the exception table is read.
+ mvm::jit::executionEngine->lock.release();
for (uint16 i = 0; i < nbe - sync; ++i) {
Exception* ex = new Exception();
ex->startpc = reader->readU2();
@@ -869,6 +873,7 @@
exceptions.push_back(ex);
}
+ mvm::jit::executionEngine->lock.acquire();
bool first = true;
for (std::vector<Exception*>::iterator i = exceptions.begin(),
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=51253&r1=51252&r2=51253&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Mon May 19 10:33:32 2008
@@ -104,8 +104,8 @@
LLVMMethodInfo* LMI = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
Function* func = LMI->getMethod();
if (func->hasNotBeenReadFromBitcode()) {
- // Don't take the JIT lock yet, as Java exceptions in the bytecode must be
- // loaded first.
+ // We are jitting. Take the lock.
+ llvm::MutexGuard locked(mvm::jit::executionEngine->lock);
JavaJIT jit;
jit.compilingClass = meth->classDef;
jit.compilingMethod = meth;
More information about the llvm-commits
mailing list