[vmkit-commits] [vmkit] r56154 - in /vmkit/branches/isolate/lib/JnJVM/VMCore: JavaJIT.cpp JavaJIT.h
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Fri Sep 12 07:21:47 PDT 2008
Author: geoffray
Date: Fri Sep 12 09:21:47 2008
New Revision: 56154
URL: http://llvm.org/viewvc/llvm-project?rev=56154&view=rev
Log:
Bugfixes and implementation of getCtpClass and getStaticInstance.
Modified:
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp?rev=56154&r1=56153&r2=56154&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.cpp Fri Sep 12 09:21:47 2008
@@ -56,10 +56,12 @@
CommonClass* cl = 0;
JavaMethod* meth = 0;
ctpInfo->infoOfMethod(index, ACC_VIRTUAL, cl, meth);
-
+
+#if !defined(MULTIPLE_VM)
if ((cl && isFinal(cl->access)) ||
(meth && (isFinal(meth->access) || isPrivate(meth->access))))
return invokeSpecial(index);
+#endif
#if !defined(WITHOUT_VTABLE) && !defined(MULTIPLE_VM)
@@ -204,9 +206,16 @@
uint32 index = 0;
if (stat) {
+#ifdef MULTIPLE_VM
+ Value* val = getClassCtp();
+ Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction,
+ val, "", currentBlock);
+ nativeArgs.push_back(res);
+#else
LLVMClassInfo* LCI =
(LLVMClassInfo*)module->getClassInfo(compilingClass);
nativeArgs.push_back(LCI->getDelegatee(this));
+#endif
index = 2;
} else {
index = 1;
@@ -392,9 +401,25 @@
#ifdef MULTIPLE_VM
Value* JavaJIT::getStaticInstanceCtp() {
- /// get the -1 offset of the ctp
- fprintf(stderr, "implement me");
- abort();
+ Value* cl = getClassCtp();
+ std::vector<Value*> indexes; //[3];
+ indexes.push_back(mvm::jit::constantZero);
+ indexes.push_back(mvm::jit::constantSeven);
+ Value* arg1 = GetElementPtrInst::Create(cl, indexes.begin(),
+ indexes.end(), "", currentBlock);
+ arg1 = new LoadInst(arg1, "", false, currentBlock);
+ return arg1;
+
+}
+
+Value* JavaJIT::getClassCtp() {
+ std::vector<Value*> indexes; //[3];
+ indexes.push_back(mvm::jit::constantOne);
+ Value* arg1 = GetElementPtrInst::Create(ctpCache, indexes.begin(),
+ indexes.end(), "", currentBlock);
+ arg1 = new LoadInst(arg1, "", false, currentBlock);
+ arg1 = new BitCastInst(arg1, JnjvmModule::JavaClassType, "", currentBlock);
+ return arg1;
}
#endif
@@ -741,6 +766,10 @@
i++;
ctpCache = i;
#endif
+ Value* addrCtpCache = new AllocaInst(JnjvmModule::ConstantPoolType, "",
+ currentBlock);
+ /// make it volatile to be sure it's on the stack
+ new StoreInst(ctpCache, addrCtpCache, true, currentBlock);
#endif
unsigned nbe = readExceptionTable(reader);
@@ -759,7 +788,8 @@
beginSynchronize();
compileOpcodes(&compilingClass->bytes->elements[start], codeLen);
-
+
+ assert(stack.size() == 0 && "Stack not empty after compiling bytecode");
// Fix a javac(?) bug where a method only throws an exception and des
// not return.
pred_iterator PI = pred_begin(endBlock);
@@ -1125,16 +1155,20 @@
push(ConstantFP::get(Type::FloatTy, ctpInfo->FloatAt(index)),
AssessorDesc::dFloat);
} else if (type == JavaConstantPool::ConstantClass) {
+#ifndef MULTIPLE_VM
if (ctpInfo->ctpRes[index]) {
CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
LLVMCommonClassInfo* LCI = module->getClassInfo(cl);
push(LCI->getDelegatee(this), AssessorDesc::dRef);
} else {
+#endif
Value* val = getResolvedClass(index, false);
Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction,
val, "", currentBlock);
push(res, AssessorDesc::dRef);
+#ifndef MULTIPLE_VM
}
+#endif
} else {
JavaThread::get()->isolate->unknownError("unknown type %d", type);
}
@@ -1541,11 +1575,10 @@
signature, meth);
#if defined(MULTIPLE_VM)
- uint32 clIndex = ctpInfo->getClassIndexFromMethod(index);
- Value* cl = getResolvedClass(clIndex, true);
-
- Value* newCtpCache = CallInst::Create(JnjvmModule::GetCtpClassFunction, cl,
- "", currentBlock);
+ Value* newCtpCache = getConstantPoolAt(index,
+ JnjvmModule::StaticCtpLookupFunction,
+ JnjvmModule::ConstantPoolType, 0,
+ false);
args.push_back(newCtpCache);
#endif
Modified: vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h?rev=56154&r1=56153&r2=56154&view=diff
==============================================================================
--- vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h (original)
+++ vmkit/branches/isolate/lib/JnJVM/VMCore/JavaJIT.h Fri Sep 12 09:21:47 2008
@@ -261,6 +261,7 @@
#if defined(MULTIPLE_VM)
llvm::Value* ctpCache;
llvm::Value* getStaticInstanceCtp();
+ llvm::Value* getClassCtp();
#endif
static const char* OpcodeNames[256];
More information about the vmkit-commits
mailing list