[llvm-commits] [vmkit] r50351 - /vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Mon Apr 28 09:10:33 PDT 2008
Author: geoffray
Date: Mon Apr 28 11:10:33 2008
New Revision: 50351
URL: http://llvm.org/viewvc/llvm-project?rev=50351&view=rev
Log:
Fix compilation of native synchronized functions.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=50351&r1=50350&r2=50351&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Mon Apr 28 11:10:33 2008
@@ -217,10 +217,44 @@
mvm::jit::executionEngine->addGlobalMapping(func, natPtr);
return llvmFunction;
}
-
+
+ currentExceptionBlock = endExceptionBlock = 0;
currentBlock = createBasicBlock("start");
BasicBlock* executeBlock = createBasicBlock("execute");
endBlock = createBasicBlock("end block");
+
+#if defined(MULTIPLE_VM)
+ Value* lastArg = 0;
+ for (Function::arg_iterator i = func->arg_begin(), e = func->arg_end();
+ i != e; ++i) {
+ lastArg = i;
+ }
+#if !defined(SERVICE_VM)
+ isolateLocal = lastArg;
+#else
+ if (compilingClass->isolate == Jnjvm::bootstrapVM) {
+ isolateLocal = lastArg;
+ } else {
+ JavaObject* loader = compilingClass->classLoader;
+ ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
+ isolateLocal = new LoadInst(vm->llvmDelegatee(), "", currentBlock);
+ Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, lastArg,
+ isolateLocal, "", currentBlock);
+ BasicBlock* ifTrue = createBasicBlock("true service call");
+ BasicBlock* endBlock = createBasicBlock("end check service call");
+ BranchInst::Create(ifTrue, endBlock, cmp, currentBlock);
+ currentBlock = ifTrue;
+ std::vector<Value*> Args;
+ Args.push_back(lastArg);
+ Args.push_back(isolateLocal);
+ CallInst::Create(ServiceDomain::serviceCallStartLLVM, Args.begin(),
+ Args.end(), "", currentBlock);
+ BranchInst::Create(endBlock, currentBlock);
+ currentBlock = endBlock;
+ }
+#endif
+#endif
+
if (funcType->getReturnType() != Type::VoidTy)
endNode = llvm::PHINode::Create(funcType->getReturnType(), "", endBlock);
More information about the llvm-commits
mailing list