[vmkit-commits] [vmkit] r54734 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaConstantPool.cpp JavaIsolate.cpp JavaJIT.cpp JavaJIT.h JavaJITOpcodes.cpp JavaMetaJIT.cpp JavaRuntime.h JavaRuntimeJIT.cpp JavaTypes.cpp JavaUpcalls.cpp Jnjvm.cpp Jnjvm.h JnjvmModuleProvider.cpp JnjvmModuleProvider.h LowerConstantCalls.cpp
Nicolas Geoffray
nicolas.geoffray at lip6.fr
Wed Aug 13 07:11:33 PDT 2008
Author: geoffray
Date: Wed Aug 13 09:11:28 2008
New Revision: 54734
URL: http://llvm.org/viewvc/llvm-project?rev=54734&view=rev
Log:
Revert back to r54731. The jnjvm module may not be a bad idea
for a clean use of LLVM.
Modified:
vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h
vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntime.h
vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h
vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Wed Aug 13 09:11:28 2008
@@ -508,25 +508,25 @@
Attribut* attribut = lookupAttribut(Attribut::constantAttribut);
if (!attribut) {
- JavaRuntime::InitField(this, obj);
+ JnjvmModule::InitField(this, obj);
} else {
Reader reader(attribut, classDef->bytes);
JavaCtpInfo * ctpInfo = classDef->ctpInfo;
uint16 idx = reader.readU2();
if (funcs == AssessorDesc::dLong) {
- JavaRuntime::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
+ JnjvmModule::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
} else if (funcs == AssessorDesc::dDouble) {
- JavaRuntime::InitField(this, obj, ctpInfo->DoubleAt(idx));
+ JnjvmModule::InitField(this, obj, ctpInfo->DoubleAt(idx));
} else if (funcs == AssessorDesc::dFloat) {
- JavaRuntime::InitField(this, obj, ctpInfo->FloatAt(idx));
+ JnjvmModule::InitField(this, obj, ctpInfo->FloatAt(idx));
} else if (funcs == AssessorDesc::dRef) {
const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[idx]);
- JavaRuntime::InitField(this, obj,
+ JnjvmModule::InitField(this, obj,
(JavaObject*)ctpInfo->resolveString(utf8, idx));
} else if (funcs == AssessorDesc::dInt || funcs == AssessorDesc::dChar ||
funcs == AssessorDesc::dShort || funcs == AssessorDesc::dByte ||
funcs == AssessorDesc::dBool) {
- JavaRuntime::InitField(this, obj, (uint64)ctpInfo->IntegerAt(idx));
+ JnjvmModule::InitField(this, obj, (uint64)ctpInfo->IntegerAt(idx));
} else {
JavaThread::get()->isolate->
unknownError("unknown constant %c", funcs->byteId);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Wed Aug 13 09:11:28 2008
@@ -419,7 +419,8 @@
cl->lookupMethodDontThrow(utf8, sign->keyName, isStatic(access), false);
if (meth) {
// don't throw if no meth, the exception will be thrown just in time
- void* F = JavaRuntime::getMethod(meth);
+ JnjvmModule* M = classDef->isolate->TheModule;
+ void* F = M->getMethod(meth);
ctpRes[index] = (void*)F;
return F;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed Aug 13 09:11:28 2008
@@ -449,11 +449,8 @@
isolate->analyseClasspathEnv(isolate->bootClasspathEnv);
- llvm::Module* mod = new llvm::Module("Isolate JnJVM");
- std::string str =
- mvm::jit::executionEngine->getTargetData()->getStringRepresentation();
- mod->setDataLayout(str);
- isolate->TheModuleProvider = new JnjvmModuleProvider(mod);
+ isolate->TheModule = new JnjvmModule("Isolate JnJVM");
+ isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->TheModule);
isolate->bootstrapThread = vm_new(isolate, JavaThread)();
isolate->bootstrapThread->initialise(0, isolate);
@@ -512,12 +509,9 @@
isolate->analyseClasspathEnv(isolate->bootClasspathEnv);
- Module* Mod = new llvm::Module("Bootstrap JnJVM");
- std::string str =
- mvm::jit::executionEngine->getTargetData()->getStringRepresentation();
- Mod->setDataLayout(str);
- JavaRuntime::initialise(Mod);
- isolate->TheModuleProvider = new JnjvmModuleProvider(Mod);
+ isolate->TheModule = new JnjvmModule("Bootstrap JnJVM");
+ isolate->TheModule->initialise();
+ isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->TheModule);
isolate->bootstrapThread = vm_new(isolate, JavaThread)();
isolate->bootstrapThread->initialise(0, isolate);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Aug 13 09:11:28 2008
@@ -38,6 +38,7 @@
#include "JavaTypes.h"
#include "JavaUpcalls.h"
#include "Jnjvm.h"
+#include "JnjvmModuleProvider.h"
#include "NativeUtil.h"
#include "Reader.h"
#include "Zip.h"
@@ -65,18 +66,18 @@
Constant* zero = mvm::jit::constantZero;
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
std::vector<Value*> args; // size = [signature->nbIn + 3];
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
+ LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
const llvm::FunctionType* virtualType = LSI->getVirtualType();
FunctionType::param_iterator it = virtualType->param_end();
makeArgs(it, index, args, signature->args.size() + 1);
JITVerifyNull(args[0]);
- Value* VT = CallInst::Create(JavaRuntime::GetVTFunction, args[0], "",
+ Value* VT = CallInst::Create(JnjvmModule::GetVTFunction, args[0], "",
currentBlock);
std::vector<Value*> indexes2; //[3];
if (meth) {
- LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(meth);
+ LLVMMethodInfo* LMI = module->getMethodInfo(meth);
indexes2.push_back(LMI->getOffset());
} else {
GlobalVariable* gv =
@@ -100,12 +101,12 @@
std::vector<Value*> Args;
Args.push_back(args[0]);
LLVMClassInfo* LCI =
- (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ (LLVMClassInfo*)module->getClassInfo(compilingClass);
Args.push_back(LCI->getVar(this));
Constant* CI = ConstantInt::get(Type::Int32Ty, index);
Args.push_back(CI);
Args.push_back(gv);
- val = invoke(JavaRuntime::VirtualLookupFunction, Args, "", currentBlock);
+ val = invoke(JnjvmModule::VirtualLookupFunction, Args, "", currentBlock);
node->addIncoming(val, currentBlock);
llvm::BranchInst::Create(endBlock, currentBlock);
@@ -175,7 +176,7 @@
} else {
JavaObject* loader = compilingClass->classLoader;
ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
- LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
+ LLVMServiceInfo* LSI = module->getServiceInfo(vm);
isolateLocal = LSI->getDelegatee(this);
Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, lastArg,
isolateLocal, "", currentBlock);
@@ -186,7 +187,7 @@
std::vector<Value*> Args;
Args.push_back(lastArg);
Args.push_back(isolateLocal);
- CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
+ CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
Args.end(), "", currentBlock);
BranchInst::Create(endBlock, currentBlock);
currentBlock = endBlock;
@@ -197,7 +198,7 @@
if (funcType->getReturnType() != Type::VoidTy)
endNode = llvm::PHINode::Create(funcType->getReturnType(), "", endBlock);
- Value* buf = llvm::CallInst::Create(JavaRuntime::GetSJLJBufferFunction,
+ Value* buf = llvm::CallInst::Create(JnjvmModule::GetSJLJBufferFunction,
"", currentBlock);
Value* test = llvm::CallInst::Create(mvm::jit::setjmpLLVM, buf, "",
currentBlock);
@@ -228,7 +229,7 @@
uint32 index = 0;
if (stat) {
LLVMClassInfo* LCI =
- (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ (LLVMClassInfo*)module->getClassInfo(compilingClass);
nativeArgs.push_back(LCI->getDelegatee(this));
index = 2;
} else {
@@ -242,7 +243,7 @@
LLVMSignatureInfo* LSI =
- JavaRuntime::getSignatureInfo(compilingMethod->getSignature());
+ module->getSignatureInfo(compilingMethod->getSignature());
const llvm::Type* valPtrType = LSI->getNativePtrType();
Value* valPtr =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, (uint64)natPtr),
@@ -259,7 +260,7 @@
if (isSynchro(compilingMethod->access))
endSynchronize();
- llvm::CallInst::Create(JavaRuntime::JniProceedPendingExceptionFunction, "",
+ llvm::CallInst::Create(JnjvmModule::JniProceedPendingExceptionFunction, "",
currentBlock);
if (funcType->getReturnType() != Type::VoidTy)
@@ -278,10 +279,10 @@
void JavaJIT::monitorEnter(Value* obj) {
std::vector<Value*> gep;
gep.push_back(mvm::jit::constantZero);
- gep.push_back(JavaRuntime::JavaObjectLockOffsetConstant);
+ gep.push_back(JnjvmModule::JavaObjectLockOffsetConstant);
Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
currentBlock);
- Value* threadId = CallInst::Create(JavaRuntime::GetThreadIDFunction, "",
+ Value* threadId = CallInst::Create(JnjvmModule::GetThreadIDFunction, "",
currentBlock);
std::vector<Value*> atomicArgs;
atomicArgs.push_back(lockPtr);
@@ -347,14 +348,14 @@
// The counter will overflow, call this function to create a new lock,
// lock it 0x101 times, and pass.
- CallInst::Create(JavaRuntime::OverflowThinLockFunction, obj, "",
+ CallInst::Create(JnjvmModule::OverflowThinLockFunction, obj, "",
currentBlock);
BranchInst::Create(OK, currentBlock);
currentBlock = FatLockBB;
// Either it's a fat lock or there is contention.
- CallInst::Create(JavaRuntime::AquireObjectFunction, obj, "", currentBlock);
+ CallInst::Create(JnjvmModule::AquireObjectFunction, obj, "", currentBlock);
BranchInst::Create(OK, currentBlock);
currentBlock = OK;
}
@@ -362,11 +363,11 @@
void JavaJIT::monitorExit(Value* obj) {
std::vector<Value*> gep;
gep.push_back(mvm::jit::constantZero);
- gep.push_back(JavaRuntime::JavaObjectLockOffsetConstant);
+ gep.push_back(JnjvmModule::JavaObjectLockOffsetConstant);
Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
currentBlock);
Value* lock = new LoadInst(lockPtr, "", currentBlock);
- Value* threadId = CallInst::Create(JavaRuntime::GetThreadIDFunction, "",
+ Value* threadId = CallInst::Create(JnjvmModule::GetThreadIDFunction, "",
currentBlock);
Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, lock, threadId, "",
@@ -408,7 +409,7 @@
currentBlock = FatLockBB;
// Either it's a fat lock or there is contention.
- CallInst::Create(JavaRuntime::ReleaseObjectFunction, obj, "", currentBlock);
+ CallInst::Create(JnjvmModule::ReleaseObjectFunction, obj, "", currentBlock);
BranchInst::Create(EndUnlock, currentBlock);
currentBlock = EndUnlock;
}
@@ -419,17 +420,17 @@
obj = llvmFunction->arg_begin();
} else {
LLVMClassInfo* LCI =
- (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ (LLVMClassInfo*)module->getClassInfo(compilingClass);
obj = LCI->getStaticVar(this);
}
#ifndef SERVICE_VM
monitorEnter(obj);
#else
if (ServiceDomain::isLockableDomain(compilingClass->isolate)) {
- llvm::CallInst::Create(JavaRuntime::AquireObjectInSharedDomainFunction,
+ llvm::CallInst::Create(JnjvmModule::AquireObjectInSharedDomainFunction,
obj, "", currentBlock);
} else {
- llvm::CallInst::Create(JavaRuntime::AquireObjectFunction,
+ llvm::CallInst::Create(JnjvmModule::AquireObjectFunction,
obj, "", currentBlock);
}
#endif
@@ -441,17 +442,17 @@
obj = llvmFunction->arg_begin();
} else {
LLVMClassInfo* LCI =
- (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ (LLVMClassInfo*)module->getClassInfo(compilingClass);
obj = LCI->getStaticVar(this);
}
#ifndef SERVICE_VM
monitorExit(obj);
#else
if (ServiceDomain::isLockableDomain(compilingClass->isolate)) {
- llvm::CallInst::Create(JavaRuntime::ReleaseObjectInSharedDomainFunction,
+ llvm::CallInst::Create(JnjvmModule::ReleaseObjectInSharedDomainFunction,
argsSync.begin(), argsSync.end(), "", currentBlock);
} else {
- llvm::CallInst::Create(JavaRuntime::ReleaseObjectFunction, argsSync.begin(),
+ llvm::CallInst::Create(JnjvmModule::ReleaseObjectFunction, argsSync.begin(),
argsSync.end(), "", currentBlock);
}
#endif
@@ -482,7 +483,7 @@
reader.seek(codeLen, Reader::SeekCur);
- LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(compilingMethod);
+ LLVMMethodInfo* LMI = module->getMethodInfo(compilingMethod);
assert(LMI);
Function* func = LMI->getMethod();
llvmFunction = parentFunction;
@@ -506,7 +507,7 @@
doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "", currentBlock));
longLocals.push_back(new AllocaInst(Type::Int64Ty, "", currentBlock));
floatLocals.push_back(new AllocaInst(Type::FloatTy, "", currentBlock));
- objectLocals.push_back(new AllocaInst(JavaRuntime::JavaObjectType, "",
+ objectLocals.push_back(new AllocaInst(JnjvmModule::JavaObjectType, "",
currentBlock));
}
@@ -562,7 +563,7 @@
} else {
JavaObject* loader = compilingClass->classLoader;
ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
- LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
+ LLVMServiceInfo* LSI = module->getServiceInfo(vm);
isolateLocal = LSI->getDelegatee(this);
Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, args[args.size() - 1],
isolateLocal, "", currentBlock);
@@ -573,7 +574,7 @@
std::vector<Value*> Args;
Args.push_back(args[args.size()- 1]);
Args.push_back(isolateLocal);
- CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
+ CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
Args.end(), "", currentBlock);
BranchInst::Create(endBlock, currentBlock);
currentBlock = endBlock;
@@ -604,7 +605,7 @@
std::vector<Value*> Args;
Args.push_back(args[args.size() - 1]);
Args.push_back(isolateLocal);
- CallInst::Create(JavaRuntime::ServiceCallStopFunction, Args.begin(),
+ CallInst::Create(JnjvmModule::ServiceCallStopFunction, Args.begin(),
Args.end(), "", currentBlock);
BranchInst::Create(newEndBlock, currentBlock);
currentBlock = newEndBlock;
@@ -658,7 +659,7 @@
{
std::vector<llvm::Value*> args;
args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
- llvm::CallInst::Create(JavaRuntime::PrintMethodStartFunction, args.begin(),
+ llvm::CallInst::Create(JnjvmModule::PrintMethodStartFunction, args.begin(),
args.end(), "", currentBlock);
}
#endif
@@ -670,7 +671,7 @@
doubleLocals.push_back(new AllocaInst(Type::DoubleTy, "", currentBlock));
longLocals.push_back(new AllocaInst(Type::Int64Ty, "", currentBlock));
floatLocals.push_back(new AllocaInst(Type::FloatTy, "", currentBlock));
- objectLocals.push_back(new AllocaInst(JavaRuntime::JavaObjectType, "",
+ objectLocals.push_back(new AllocaInst(JnjvmModule::JavaObjectType, "",
currentBlock));
}
@@ -725,7 +726,7 @@
} else {
JavaObject* loader = compilingClass->classLoader;
ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
- LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
+ LLVMServiceInfo* LSI = module->getServiceInfo(vm);
isolateLocal = LSI->getDelegatee(this);
Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, i, isolateLocal, "",
currentBlock);
@@ -736,7 +737,7 @@
std::vector<Value*> Args;
Args.push_back(i);
Args.push_back(isolateLocal);
- CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
+ CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
Args.end(), "", currentBlock);
BranchInst::Create(endBlock, currentBlock);
currentBlock = endBlock;
@@ -782,7 +783,7 @@
{
std::vector<llvm::Value*> args;
args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
- llvm::CallInst::Create(JavaRuntime::PrintMethodEndFunction, args.begin(),
+ llvm::CallInst::Create(JnjvmModule::PrintMethodEndFunction, args.begin(),
args.end(), "", currentBlock);
}
#endif
@@ -798,7 +799,7 @@
std::vector<Value*> Args;
Args.push_back(i);
Args.push_back(isolateLocal);
- CallInst::Create(JavaRuntime::ServiceCallStopFunction, Args.begin(),
+ CallInst::Create(JnjvmModule::ServiceCallStopFunction, Args.begin(),
Args.end(), "", currentBlock);
BranchInst::Create(newEndBlock, currentBlock);
currentBlock = newEndBlock;
@@ -815,7 +816,7 @@
if (PI == PE) {
endExceptionBlock->eraseFromParent();
} else {
- CallInst* ptr_eh_ptr = CallInst::Create(JavaRuntime::GetExceptionFunction,
+ CallInst* ptr_eh_ptr = CallInst::Create(JnjvmModule::GetExceptionFunction,
"eh_ptr", endExceptionBlock);
llvm::CallInst::Create(mvm::jit::unwindResume, ptr_eh_ptr, "",
endExceptionBlock);
@@ -850,7 +851,7 @@
nbe += sync;
JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
if (nbe) {
- supplLocal = new AllocaInst(JavaRuntime::JavaObjectType, "exceptionVar",
+ supplLocal = new AllocaInst(JnjvmModule::JavaObjectType, "exceptionVar",
currentBlock);
}
@@ -868,11 +869,11 @@
if (isVirtual(compilingMethod->access)) {
argsSync.push_back(llvmFunction->arg_begin());
} else {
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
Value* arg = LCI->getStaticVar(this);
argsSync.push_back(arg);
}
- llvm::CallInst::Create(JavaRuntime::ReleaseObjectFunction, argsSync.begin(), argsSync.end(),
+ llvm::CallInst::Create(JnjvmModule::ReleaseObjectFunction, argsSync.begin(), argsSync.end(),
"", synchronizeExceptionBlock);
llvm::BranchInst::Create(endExceptionBlock, synchronizeExceptionBlock);
@@ -1026,9 +1027,9 @@
Value* cl = 0;
currentBlock = cur->realTest;
assert(cur->catchClass);
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(cur->catchClass);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cur->catchClass);
cl = LCI->getVar(this);
- Value* cmp = llvm::CallInst::Create(JavaRuntime::CompareExceptionFunction, cl, "",
+ Value* cmp = llvm::CallInst::Create(JnjvmModule::CompareExceptionFunction, cl, "",
currentBlock);
llvm::BranchInst::Create(cur->handler, bbNext, cmp, currentBlock);
if (nodeNext)
@@ -1038,9 +1039,9 @@
cur->handlerPHI = llvm::PHINode::Create(mvm::jit::ptrType, "",
cur->handler);
cur->handlerPHI->addIncoming(cur->exceptionPHI, currentBlock);
- Value* exc = llvm::CallInst::Create(JavaRuntime::GetJavaExceptionFunction,
+ Value* exc = llvm::CallInst::Create(JnjvmModule::GetJavaExceptionFunction,
"", cur->handler);
- llvm::CallInst::Create(JavaRuntime::ClearExceptionFunction, "",
+ llvm::CallInst::Create(JnjvmModule::ClearExceptionFunction, "",
cur->handler);
llvm::CallInst::Create(mvm::jit::exceptionBeginCatch, cur->handlerPHI,
"tmp8", cur->handler);
@@ -1097,16 +1098,16 @@
#ifndef MULTIPLE_VM
val = compilingClass->isolate->UTF8ToStr(utf8);
gv =
- new GlobalVariable(JavaRuntime::JavaObjectType, false,
+ new GlobalVariable(JnjvmModule::JavaObjectType, false,
GlobalValue::ExternalLinkage,
- JavaRuntime::JavaObjectNullConstant, "",
+ JnjvmModule::JavaObjectNullConstant, "",
module);
#else
val = (void*)utf8;
gv =
- new GlobalVariable(JavaRuntime::JavaArrayUInt16Type, false,
+ new GlobalVariable(JnjvmModule::JavaArrayUInt16Type, false,
GlobalValue::ExternalLinkage,
- JavaRuntime::UTF8NullConstant, "",
+ JnjvmModule::UTF8NullConstant, "",
module);
#endif
@@ -1115,7 +1116,7 @@
GenericValue Val = GenericValue(val);
llvm::GenericValue * Ptr = (llvm::GenericValue*)ptr;
mvm::jit::executionEngine->StoreValueToMemory(Val, Ptr,
- JavaRuntime::JavaObjectType);
+ JnjvmModule::JavaObjectType);
toPush = new LoadInst(gv, "", currentBlock);
ctpInfo->ctpRes[index] = gv;
compilingClass->release();
@@ -1129,7 +1130,7 @@
currentBlock);
}
#ifdef MULTIPLE_VM
- CallInst* C = llvm::CallInst::Create(JavaRuntime::RuntimeUTF8ToStrFunction,
+ CallInst* C = llvm::CallInst::Create(JnjvmModule::RuntimeUTF8ToStrFunction,
toPush, "", currentBlock);
push(C, AssessorDesc::dRef);
#else
@@ -1150,11 +1151,11 @@
} else if (type == JavaCtpInfo::ConstantClass) {
if (ctpInfo->ctpRes[index]) {
CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(cl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(cl);
push(LCI->getDelegatee(this), AssessorDesc::dRef);
} else {
Value* val = getResolvedClass(index, false);
- Value* res = CallInst::Create(JavaRuntime::GetClassDelegateeFunction, val, "",
+ Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction, val, "",
currentBlock);
push(res, AssessorDesc::dRef);
}
@@ -1166,7 +1167,7 @@
void JavaJIT::JITVerifyNull(Value* obj) {
JavaJIT* jit = this;
- Constant* zero = JavaRuntime::JavaObjectNullConstant;
+ Constant* zero = JnjvmModule::JavaObjectNullConstant;
Value* test = new ICmpInst(ICmpInst::ICMP_EQ, obj, zero, "",
jit->currentBlock);
@@ -1176,12 +1177,12 @@
llvm::BranchInst::Create(exit, cont, test, jit->currentBlock);
std::vector<Value*> args;
if (currentExceptionBlock != endExceptionBlock) {
- llvm::InvokeInst::Create(JavaRuntime::NullPointerExceptionFunction,
+ llvm::InvokeInst::Create(JnjvmModule::NullPointerExceptionFunction,
unifiedUnreachable,
currentExceptionBlock, args.begin(),
args.end(), "", exit);
} else {
- llvm::CallInst::Create(JavaRuntime::NullPointerExceptionFunction,
+ llvm::CallInst::Create(JnjvmModule::NullPointerExceptionFunction,
args.begin(), args.end(), "", exit);
new UnreachableInst(exit);
}
@@ -1214,12 +1215,12 @@
args.push_back(obj);
args.push_back(index);
if (currentExceptionBlock != endExceptionBlock) {
- llvm::InvokeInst::Create(JavaRuntime::IndexOutOfBoundsExceptionFunction,
+ llvm::InvokeInst::Create(JnjvmModule::IndexOutOfBoundsExceptionFunction,
unifiedUnreachable,
currentExceptionBlock, args.begin(),
args.end(), "", ifFalse);
} else {
- llvm::CallInst::Create(JavaRuntime::IndexOutOfBoundsExceptionFunction,
+ llvm::CallInst::Create(JnjvmModule::IndexOutOfBoundsExceptionFunction,
args.begin(), args.end(), "", ifFalse);
new UnreachableInst(ifFalse);
}
@@ -1232,7 +1233,7 @@
std::vector<Value*> indexes; //[3];
indexes.push_back(zero);
- indexes.push_back(JavaRuntime::JavaArrayElementsOffsetConstant);
+ indexes.push_back(JnjvmModule::JavaArrayElementsOffsetConstant);
indexes.push_back(index);
Value* ptr = llvm::GetElementPtrInst::Create(val, indexes.begin(),
indexes.end(),
@@ -1491,7 +1492,7 @@
const UTF8* name = 0;
const UTF8* cl = 0;
ctpInfo->nameOfStaticOrSpecialMethod(index, cl, name, signature);
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
+ LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
const llvm::FunctionType* virtualType = LSI->getVirtualType();
llvm::Instruction* val = 0;
@@ -1536,7 +1537,7 @@
const UTF8* name = 0;
const UTF8* cl = 0;
ctpInfo->nameOfStaticOrSpecialMethod(index, cl, name, signature);
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
+ LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
const llvm::FunctionType* staticType = LSI->getStaticType();
llvm::Instruction* val = 0;
@@ -1559,11 +1560,11 @@
uint32 clIndex = ctpInfo->getClassIndexFromMethod(index);
Class* mycl = (Class*)(ctpInfo->getMethodClassIfLoaded(clIndex));
if (mycl && mycl->status >= resolved) {
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(mycl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(mycl);
Value* arg = LCI->getVar(this);
- arg = invoke(JavaRuntime::InitialisationCheckFunction, arg, "",
+ arg = invoke(JnjvmModule::InitialisationCheckFunction, arg, "",
currentBlock);
- CallInst::Create(JavaRuntime::ForceInitialisationCheckFunction, arg, "",
+ CallInst::Create(JnjvmModule::ForceInitialisationCheckFunction, arg, "",
currentBlock);
}
@@ -1589,20 +1590,20 @@
Value* JavaJIT::getResolvedClass(uint16 index, bool clinit) {
GlobalVariable * gv =
- new GlobalVariable(JavaRuntime::JavaClassType, false,
+ new GlobalVariable(JnjvmModule::JavaClassType, false,
GlobalValue::ExternalLinkage,
- JavaRuntime::JavaClassNullConstant, "",
+ JnjvmModule::JavaClassNullConstant, "",
module);
Value* arg1 = new LoadInst(gv, "", false, currentBlock);
Value* test = new ICmpInst(ICmpInst::ICMP_EQ, arg1,
- JavaRuntime::JavaClassNullConstant, "",
+ JnjvmModule::JavaClassNullConstant, "",
currentBlock);
BasicBlock* trueCl = createBasicBlock("Cl OK");
BasicBlock* falseCl = createBasicBlock("Cl Not OK");
- PHINode* node = llvm::PHINode::Create(JavaRuntime::JavaClassType, "",
+ PHINode* node = llvm::PHINode::Create(JnjvmModule::JavaClassType, "",
trueCl);
node->addIncoming(arg1, currentBlock);
llvm::BranchInst::Create(falseCl, trueCl, test, currentBlock);
@@ -1610,7 +1611,7 @@
currentBlock = falseCl;
std::vector<Value*> Args;
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
Value* v = LCI->getVar(this);
Args.push_back(v);
ConstantInt* CI = ConstantInt::get(Type::Int32Ty, index);
@@ -1621,7 +1622,7 @@
} else {
Args.push_back(mvm::jit::constantZero);
}
- Value* res = invoke(JavaRuntime::ClassLookupFunction, Args, "",
+ Value* res = invoke(JnjvmModule::ClassLookupFunction, Args, "",
currentBlock);
node->addIncoming(res, currentBlock);
@@ -1629,7 +1630,7 @@
currentBlock = trueCl;
#ifdef MULTIPLE_VM
if (clinit)
- return invoke(JavaRuntime::InitialisationCheckFunction, node, "",
+ return invoke(JnjvmModule::InitialisationCheckFunction, node, "",
currentBlock);
else
#endif
@@ -1646,35 +1647,35 @@
Value* Cl = 0;
if (!cl || !cl->isResolved()) {
Cl = getResolvedClass(index, true);
- Size = CallInst::Create(JavaRuntime::GetObjectSizeFromClassFunction, Cl,
+ Size = CallInst::Create(JnjvmModule::GetObjectSizeFromClassFunction, Cl,
"", currentBlock);
- VT = CallInst::Create(JavaRuntime::GetVTFromClassFunction, Cl, "",
+ VT = CallInst::Create(JnjvmModule::GetVTFromClassFunction, Cl, "",
currentBlock);
} else {
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(cl);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cl);
Size = LCI->getVirtualSize(this);
VT = LCI->getVirtualTable(this);
Cl = LCI->getVar(this);
#ifndef MULTIPLE_VM
if (!cl->isReady())
#endif
- Cl = invoke(JavaRuntime::InitialisationCheckFunction, Cl, "", currentBlock);
+ Cl = invoke(JnjvmModule::InitialisationCheckFunction, Cl, "", currentBlock);
}
std::vector<Value*> args;
args.push_back(Size);
args.push_back(VT);
#ifdef MULTIPLE_GC
- args.push_back(CallInst::Create(JavaRuntime::GetCollectorFunction,
+ args.push_back(CallInst::Create(JnjvmModule::GetCollectorFunction,
isolateLocal, "", currentBlock));
#endif
- Value* val = invoke(JavaRuntime::JavaObjectAllocateFunction, args, "",
+ Value* val = invoke(JnjvmModule::JavaObjectAllocateFunction, args, "",
currentBlock);
// Set the class
std::vector<Value*> gep;
gep.push_back(mvm::jit::constantZero);
- gep.push_back(JavaRuntime::JavaObjectClassOffsetConstant);
+ gep.push_back(JnjvmModule::JavaObjectClassOffsetConstant);
Value* GEP = GetElementPtrInst::Create(val, gep.begin(), gep.end(), "",
currentBlock);
new StoreInst(Cl, GEP, currentBlock);
@@ -1684,7 +1685,7 @@
}
Value* JavaJIT::arraySize(Value* val) {
- return llvm::CallInst::Create(JavaRuntime::ArrayLengthFunction, val, "",
+ return llvm::CallInst::Create(JnjvmModule::ArrayLengthFunction, val, "",
currentBlock);
}
@@ -1714,13 +1715,13 @@
&& field->classDef->isReady()
#endif
) {
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(field->classDef);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(field->classDef);
if (stat) {
object = LCI->getStaticVar(this);
}
const Type* type = stat ? LCI->getStaticType() :
LCI->getVirtualType();
- LLVMFieldInfo* LFI = JavaRuntime::getFieldInfo(field);
+ LLVMFieldInfo* LFI = module->getFieldInfo(field);
return fieldGetter(this, type, object, LFI->getOffset());
} else {
const Type* Pty = mvm::jit::arrayPtrType;
@@ -1769,16 +1770,16 @@
if (object) {
args.push_back(object);
} else {
- args.push_back(JavaRuntime::JavaObjectNullConstant);
+ args.push_back(JnjvmModule::JavaObjectNullConstant);
}
- LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
+ LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
args.push_back(LCI->getVar(this));
Constant* CI = ConstantInt::get(Type::Int32Ty, index);
args.push_back(CI);
args.push_back(stat ? mvm::jit::constantOne : mvm::jit::constantZero);
args.push_back(gvStaticInstance);
args.push_back(gv);
- Value* tmp = invoke(JavaRuntime::FieldLookupFunction, args, "", currentBlock);
+ Value* tmp = invoke(JnjvmModule::FieldLookupFunction, args, "", currentBlock);
node->addIncoming(tmp, currentBlock);
llvm::BranchInst::Create(endBlock, currentBlock);
@@ -1961,7 +1962,7 @@
JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
+ LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
const llvm::FunctionType* virtualType = LSI->getVirtualType();
const llvm::PointerType* virtualPtrType = LSI->getVirtualPtrType();
@@ -1987,7 +1988,7 @@
Value* llvmEnv =
ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
uint64_t (enveloppe)),
- JavaRuntime::EnveloppeType);
+ JnjvmModule::EnveloppeType);
JITVerifyNull(args[0]);
@@ -1999,7 +2000,7 @@
"", currentBlock);
Value* cache = new LoadInst(cachePtr, "", currentBlock);
- Value* cl = CallInst::Create(JavaRuntime::GetClassFunction, args[0], "",
+ Value* cl = CallInst::Create(JnjvmModule::GetClassFunction, args[0], "",
currentBlock);
std::vector<Value*> args3;
args3.push_back(zero);
@@ -2016,7 +2017,7 @@
BranchInst::Create(ifTrue, ifFalse, cmp, currentBlock);
currentBlock = ifFalse;
- Value* _meth = invoke(JavaRuntime::InterfaceLookupFunction, cache, args[0],
+ Value* _meth = invoke(JnjvmModule::InterfaceLookupFunction, cache, args[0],
"", ifFalse);
Value* meth = new BitCastInst(_meth, virtualPtrType, "",
currentBlock);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Wed Aug 13 09:11:28 2008
@@ -17,7 +17,6 @@
#include "llvm/DerivedTypes.h"
#include "llvm/Function.h"
#include "llvm/Instructions.h"
-#include "llvm/Module.h"
#include "llvm/Value.h"
#include "types.h"
@@ -26,7 +25,7 @@
#include "mvm/PrintBuffer.h"
#include "JavaTypes.h"
-#include "JavaRuntime.h"
+#include "JnjvmModule.h"
namespace jnjvm {
@@ -59,7 +58,7 @@
class JavaJIT {
public:
- llvm::Module* module;
+ JnjvmModule* module;
static void invokeOnceVoid(Jnjvm* vm, JavaObject* loader,
const char* className,
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Aug 13 09:11:28 2008
@@ -30,7 +30,6 @@
#include "JavaConstantPool.h"
#include "JavaObject.h"
#include "JavaJIT.h"
-#include "JavaRuntime.h"
#include "JavaThread.h"
#include "JavaTypes.h"
#include "Jnjvm.h"
@@ -131,7 +130,7 @@
(int64_t)OpcodeNames[bytecodes[i]]));
args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)i));
args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
- CallInst::Create(JavaRuntime::PrintExecutionFunction, args.begin(),
+ CallInst::Create(JnjvmModule::PrintExecutionFunction, args.begin(),
args.end(), "", currentBlock);
}
#endif
@@ -143,7 +142,7 @@
switch (bytecodes[i]) {
case ACONST_NULL :
- push(JavaRuntime::JavaObjectNullConstant, AssessorDesc::dRef);
+ push(JnjvmModule::JavaObjectNullConstant, AssessorDesc::dRef);
break;
case ICONST_M1 :
@@ -366,7 +365,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt32Type);
+ JnjvmModule::JavaArraySInt32Type);
push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dInt);
break;
}
@@ -375,7 +374,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayLongType);
+ JnjvmModule::JavaArrayLongType);
push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dLong);
push(mvm::jit::constantZero, AssessorDesc::dInt);
break;
@@ -385,7 +384,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayFloatType);
+ JnjvmModule::JavaArrayFloatType);
push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dFloat);
break;
}
@@ -394,7 +393,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayDoubleType);
+ JnjvmModule::JavaArrayDoubleType);
push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dDouble);
push(mvm::jit::constantZero, AssessorDesc::dInt);
break;
@@ -404,7 +403,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayObjectType);
+ JnjvmModule::JavaArrayObjectType);
push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dRef);
break;
}
@@ -413,7 +412,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt8Type);
+ JnjvmModule::JavaArraySInt8Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
AssessorDesc::dInt);
@@ -424,7 +423,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayUInt16Type);
+ JnjvmModule::JavaArrayUInt16Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
AssessorDesc::dInt);
@@ -435,7 +434,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt16Type);
+ JnjvmModule::JavaArraySInt16Type);
Value* val = new LoadInst(ptr, "", currentBlock);
push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
AssessorDesc::dInt);
@@ -580,7 +579,7 @@
Value* index = popAsInt();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt32Type);
+ JnjvmModule::JavaArraySInt32Type);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -591,7 +590,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayLongType);
+ JnjvmModule::JavaArrayLongType);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -601,7 +600,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayFloatType);
+ JnjvmModule::JavaArrayFloatType);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -612,7 +611,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayDoubleType);
+ JnjvmModule::JavaArrayDoubleType);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -622,7 +621,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayObjectType);
+ JnjvmModule::JavaArrayObjectType);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -635,7 +634,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt8Type);
+ JnjvmModule::JavaArraySInt8Type);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -651,7 +650,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArrayUInt16Type);
+ JnjvmModule::JavaArrayUInt16Type);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -667,7 +666,7 @@
Value* index = pop();
Value* obj = pop();
Value* ptr = verifyAndComputePtr(obj, index,
- JavaRuntime::JavaArraySInt16Type);
+ JnjvmModule::JavaArraySInt16Type);
new StoreInst(val, ptr, false, currentBlock);
break;
}
@@ -1647,7 +1646,7 @@
Value* expr = ConstantExpr::getIntToPtr(
ConstantInt::get(Type::Int64Ty,
uint64_t (jsrIndex++)),
- JavaRuntime::JavaObjectType);
+ JnjvmModule::JavaObjectType);
new StoreInst(expr, supplLocal, false, currentBlock);
BranchInst::Create(opcodeInfos[tmp + readS2(bytecodes, i)].newBlock,
@@ -1830,7 +1829,7 @@
uint8 id = bytecodes[++i];
AssessorDesc* ass = AssessorDesc::arrayType(id);
dcl = ass->arrayClass;
- TheVT = JavaRuntime::JavaObjectVirtualTableGV;
+ TheVT = JnjvmModule::JavaObjectVirtualTableGV;
LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[ass->numId];
sizeElement = LAI.sizeInBytesConstant;
} else {
@@ -1842,11 +1841,11 @@
AssessorDesc::constructArrayName(vm, 0, 1, className);
dcl = vm->constructArray(arrayName, compilingClass->classLoader);
- TheVT = JavaRuntime::ArrayObjectVirtualTableGV;
+ TheVT = JnjvmModule::ArrayObjectVirtualTableGV;
sizeElement = mvm::jit::constantPtrSize;
}
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
llvm::Value* valCl = LCI->getVar(this);
llvm::Value* arg1 = popAsInt();
@@ -1862,19 +1861,19 @@
std::vector<Value*> exArgs;
exArgs.push_back(arg1);
if (currentExceptionBlock != endExceptionBlock) {
- InvokeInst::Create(JavaRuntime::NegativeArraySizeExceptionFunction,
+ InvokeInst::Create(JnjvmModule::NegativeArraySizeExceptionFunction,
unifiedUnreachable,
currentExceptionBlock, exArgs.begin(),
exArgs.end(), "", currentBlock);
} else {
- CallInst::Create(JavaRuntime::NegativeArraySizeExceptionFunction,
+ CallInst::Create(JnjvmModule::NegativeArraySizeExceptionFunction,
exArgs.begin(), exArgs.end(), "", currentBlock);
new UnreachableInst(currentBlock);
}
currentBlock = BB2;
cmp = new ICmpInst(ICmpInst::ICMP_SGT, arg1,
- JavaRuntime::MaxArraySizeConstant,
+ JnjvmModule::MaxArraySizeConstant,
"", currentBlock);
BB1 = createBasicBlock("");
@@ -1883,12 +1882,12 @@
BranchInst::Create(BB1, BB2, cmp, currentBlock);
currentBlock = BB1;
if (currentExceptionBlock != endExceptionBlock) {
- InvokeInst::Create(JavaRuntime::OutOfMemoryErrorFunction,
+ InvokeInst::Create(JnjvmModule::OutOfMemoryErrorFunction,
unifiedUnreachable,
currentExceptionBlock, exArgs.begin(),
exArgs.end(), "", currentBlock);
} else {
- CallInst::Create(JavaRuntime::OutOfMemoryErrorFunction,
+ CallInst::Create(JnjvmModule::OutOfMemoryErrorFunction,
exArgs.begin(), exArgs.end(), "", currentBlock);
new UnreachableInst(currentBlock);
}
@@ -1897,24 +1896,24 @@
Value* mult = BinaryOperator::createMul(arg1, sizeElement, "",
currentBlock);
Value* size =
- BinaryOperator::createAdd(JavaRuntime::JavaObjectSizeConstant, mult,
+ BinaryOperator::createAdd(JnjvmModule::JavaObjectSizeConstant, mult,
"", currentBlock);
std::vector<Value*> args;
args.push_back(size);
args.push_back(new LoadInst(TheVT, "", currentBlock));
#ifdef MULTIPLE_GC
- args.push_back(CallInst::Create(JavaRuntime::GetCollectorFunction,
+ args.push_back(CallInst::Create(JnjvmModule::GetCollectorFunction,
isolateLocal, "", currentBlock));
#endif
- Value* res = invoke(JavaRuntime::JavaObjectAllocateFunction, args, "",
+ Value* res = invoke(JnjvmModule::JavaObjectAllocateFunction, args, "",
currentBlock);
- Value* cast = new BitCastInst(res, JavaRuntime::JavaArrayType, "",
+ Value* cast = new BitCastInst(res, JnjvmModule::JavaArrayType, "",
currentBlock);
// Set the size
std::vector<Value*> gep4;
gep4.push_back(mvm::jit::constantZero);
- gep4.push_back(JavaRuntime::JavaArraySizeOffsetConstant);
+ gep4.push_back(JnjvmModule::JavaArraySizeOffsetConstant);
Value* GEP = GetElementPtrInst::Create(cast, gep4.begin(), gep4.end(),
"", currentBlock);
new StoreInst(arg1, GEP, currentBlock);
@@ -1922,7 +1921,7 @@
// Set the class
std::vector<Value*> gep;
gep.push_back(mvm::jit::constantZero);
- gep.push_back(JavaRuntime::JavaObjectClassOffsetConstant);
+ gep.push_back(JnjvmModule::JavaObjectClassOffsetConstant);
GEP = GetElementPtrInst::Create(res, gep.begin(), gep.end(), "",
currentBlock);
new StoreInst(valCl, GEP, currentBlock);
@@ -1944,12 +1943,12 @@
std::vector<Value*> args;
args.push_back(arg);
if (currentExceptionBlock != endExceptionBlock) {
- InvokeInst::Create(JavaRuntime::ThrowExceptionFunction,
+ InvokeInst::Create(JnjvmModule::ThrowExceptionFunction,
unifiedUnreachable,
currentExceptionBlock, args.begin(), args.end(),
"", currentBlock);
} else {
- CallInst::Create(JavaRuntime::ThrowExceptionFunction, args.begin(),
+ CallInst::Create(JnjvmModule::ThrowExceptionFunction, args.begin(),
args.end(), "", currentBlock);
new UnreachableInst(currentBlock);
}
@@ -1964,7 +1963,7 @@
Value* obj = top();
Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
- JavaRuntime::JavaObjectNullConstant,
+ JnjvmModule::JavaObjectNullConstant,
"", currentBlock);
BasicBlock* ifTrue = createBasicBlock("null checkcast");
@@ -1974,7 +1973,7 @@
currentBlock = ifFalse;
Value* clVar = 0;
if (dcl) {
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
clVar = LCI->getVar(this);
} else {
clVar = getResolvedClass(index, false);
@@ -1982,7 +1981,7 @@
std::vector<Value*> args;
args.push_back(obj);
args.push_back(clVar);
- Value* call = CallInst::Create(JavaRuntime::InstanceOfFunction,
+ Value* call = CallInst::Create(JnjvmModule::InstanceOfFunction,
args.begin(), args.end(),
"", currentBlock);
@@ -1993,12 +1992,12 @@
exArgs.push_back(obj);
exArgs.push_back(clVar);
if (currentExceptionBlock != endExceptionBlock) {
- InvokeInst::Create(JavaRuntime::ClassCastExceptionFunction,
+ InvokeInst::Create(JnjvmModule::ClassCastExceptionFunction,
unifiedUnreachable,
currentExceptionBlock, exArgs.begin(),
exArgs.end(), "", ex);
} else {
- CallInst::Create(JavaRuntime::ClassCastExceptionFunction,
+ CallInst::Create(JnjvmModule::ClassCastExceptionFunction,
exArgs.begin(), exArgs.end(), "", ex);
new UnreachableInst(ex);
}
@@ -2014,7 +2013,7 @@
Value* clVar = 0;
if (dcl) {
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
clVar = LCI->getVar(this);
} else {
clVar = getResolvedClass(index, false);
@@ -2022,7 +2021,7 @@
std::vector<Value*> args;
args.push_back(pop());
args.push_back(clVar);
- Value* val = CallInst::Create(JavaRuntime::InstanceOfFunction,
+ Value* val = CallInst::Create(JnjvmModule::InstanceOfFunction,
args.begin(), args.end(), "",
currentBlock);
push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
@@ -2034,10 +2033,10 @@
Value* obj = pop();
#ifdef SERVICE_VM
if (ServiceDomain::isLockableDomain(compilingClass->isolate))
- invoke(JavaRuntime::AquireObjectInSharedDomainFunction, obj, "",
+ invoke(JnjvmModule::AquireObjectInSharedDomainFunction, obj, "",
currentBlock);
else
- invoke(JavaRuntime::AquireObjectFunction, obj, "",
+ invoke(JnjvmModule::AquireObjectFunction, obj, "",
currentBlock);
#else
JITVerifyNull(obj);
@@ -2050,10 +2049,10 @@
Value* obj = pop();
#ifdef SERVICE_VM
if (ServiceDomain::isLockableDomain(compilingClass->isolate))
- invoke(JavaRuntime::ReleaseObjectInSharedDomainFunction, obj, "",
+ invoke(JnjvmModule::ReleaseObjectInSharedDomainFunction, obj, "",
currentBlock);
else
- invoke(JavaRuntime::ReleaseObjectFunction, obj, "",
+ invoke(JnjvmModule::ReleaseObjectFunction, obj, "",
currentBlock);
#else
JITVerifyNull(obj);
@@ -2075,7 +2074,7 @@
compilingClass->ctpInfo->loadClass(index);
- LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
+ LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
Value* valCl = LCI->getVar(this);
Value** args = (Value**)alloca(sizeof(Value*) * (dim + 2));
args[0] = valCl;
@@ -2091,7 +2090,7 @@
#ifdef MULTIPLE_VM
Args.push_back(isolateLocal);
#endif
- push(invoke(JavaRuntime::MultiCallNewFunction, Args, "", currentBlock),
+ push(invoke(JnjvmModule::MultiCallNewFunction, Args, "", currentBlock),
AssessorDesc::dRef);
break;
}
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Wed Aug 13 09:11:28 2008
@@ -21,6 +21,7 @@
#include "JavaThread.h"
#include "JavaTypes.h"
#include "Jnjvm.h"
+#include "JnjvmModule.h"
using namespace jnjvm;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntime.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntime.h?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntime.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntime.h Wed Aug 13 09:11:28 2008
@@ -6,6 +6,16 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+//
+// This file defines the Java runtime LLVM requires to execute Java programs.
+// The LLVM IR will perform JVM calls or access global variables that will
+// be defined at runtime.
+//
+// A clean implementation will create global variables and functions for each
+// module. Currently we don't do this, and the verifier pass in LLVM does not
+// like it.
+//
+//===----------------------------------------------------------------------===//
#ifndef JNJVM_JAVA_RUNTIME_H
#define JNJVM_JAVA_RUNTIME_H
@@ -87,7 +97,11 @@
/// virtualSizeLLVM - The LLVM constant size of instances of this class.
///
llvm::ConstantInt* virtualSizeConstant;
+
+#ifndef MULTIPLE_VM
llvm::GlobalVariable* staticVarGV;
+#endif
+
llvm::GlobalVariable* virtualTableGV;
llvm::Function* virtualTracerFunction;
llvm::Function* staticTracerFunction;
@@ -111,7 +125,9 @@
LLVMClassInfo(CommonClass* cl) :
LLVMCommonClassInfo(cl),
virtualSizeConstant(0),
+#ifndef MULITPLE_VM
staticVarGV(0),
+#endif
virtualTableGV(0),
virtualTracerFunction(0),
staticTracerFunction(0),
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Wed Aug 13 09:11:28 2008
@@ -22,6 +22,7 @@
#include "JavaThread.h"
#include "JavaTypes.h"
#include "Jnjvm.h"
+#include "JnjvmModule.h"
#include "LockedMap.h"
#ifdef SERVICE_VM
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed Aug 13 09:11:28 2008
@@ -511,7 +511,7 @@
intptr_t Signdef::staticCallBuf() {
if (!_staticCallBuf) {
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
+ LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
LSI->getStaticBuf();
}
return _staticCallBuf;
@@ -519,7 +519,7 @@
intptr_t Signdef::virtualCallBuf() {
if (!_virtualCallBuf) {
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
+ LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
LSI->getVirtualBuf();
}
return _virtualCallBuf;
@@ -527,7 +527,7 @@
intptr_t Signdef::staticCallAP() {
if (!_staticCallAP) {
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
+ LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
LSI->getStaticAP();
}
return _staticCallAP;
@@ -535,7 +535,7 @@
intptr_t Signdef::virtualCallAP() {
if (!_virtualCallAP) {
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
+ LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
LSI->getVirtualAP();
}
return _virtualCallAP;
Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Wed Aug 13 09:11:28 2008
@@ -15,12 +15,12 @@
#include "JavaClass.h"
#include "JavaJIT.h"
#include "JavaObject.h"
-#include "JavaRuntime.h"
#include "JavaString.h"
#include "JavaThread.h"
#include "JavaTypes.h"
#include "JavaUpcalls.h"
#include "Jnjvm.h"
+#include "JnjvmModule.h"
#define COMPILE_METHODS(cl) \
for (CommonClass::method_iterator i = cl->virtualMethods.begin(), \
@@ -379,11 +379,11 @@
JavaMethod* internString =
UPCALL_METHOD(vm, "java/lang/VMString", "intern",
"(Ljava/lang/String;)Ljava/lang/String;", ACC_STATIC);
- JavaRuntime::setMethod(internString, "internString");
+ vm->TheModule->setMethod(internString, "internString");
JavaMethod* isArray =
UPCALL_METHOD(vm, "java/lang/Class", "isArray", "()Z", ACC_VIRTUAL);
- JavaRuntime::setMethod(isArray, "isArray");
+ vm->TheModule->setMethod(isArray, "isArray");
ClasspathThread::initialise(vm);
@@ -400,17 +400,17 @@
JavaMethod* getCallingClass =
UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClass",
"()Ljava/lang/Class;", ACC_STATIC);
- JavaRuntime::setMethod(getCallingClass, "getCallingClass");
+ vm->TheModule->setMethod(getCallingClass, "getCallingClass");
JavaMethod* getCallingClassLoader =
UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClassLoader",
"()Ljava/lang/ClassLoader;", ACC_STATIC);
- JavaRuntime::setMethod(getCallingClassLoader, "getCallingClassLoader");
+ vm->TheModule->setMethod(getCallingClassLoader, "getCallingClassLoader");
JavaMethod* postProperties =
UPCALL_METHOD(vm, "gnu/classpath/VMSystemProperties", "postInit",
"(Ljava/util/Properties;)V", ACC_STATIC);
- JavaRuntime::setMethod(postProperties, "propertiesPostInit");
+ vm->TheModule->setMethod(postProperties, "propertiesPostInit");
}
extern "C" JavaString* internString(JavaString* obj) {
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Aug 13 09:11:28 2008
@@ -331,7 +331,7 @@
cl->super->initialiseClass();
}
- JavaRuntime::resolveStaticClass((Class*)cl);
+ TheModule->resolveStaticClass((Class*)cl);
*status = inClinit;
JavaMethod* meth = cl->lookupMethodDontThrow(clinitName, clinitType, true,
@@ -401,7 +401,7 @@
loadParents((Class*)cl);
cl->acquire();
cl->status = prepared;
- JavaRuntime::resolveVirtualClass((Class*)cl);
+ TheModule->resolveVirtualClass((Class*)cl);
cl->status = resolved;
}
cl->release();
Modified: vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h Wed Aug 13 09:11:28 2008
@@ -26,10 +26,6 @@
#define vm_new(vm, cl) gc_new(cl)
#endif
-namespace llvm {
- class Module;
-}
-
namespace jnjvm {
class ArrayUInt8;
@@ -41,6 +37,7 @@
class JavaMethod;
class JavaObject;
class JavaString;
+class JnjvmModule;
class JnjvmModuleProvider;
class Reader;
class Typedef;
@@ -262,7 +259,7 @@
JnjvmModuleProvider* TheModuleProvider;
- llvm::Module* TheModule;
+ JnjvmModule* TheModule;
#ifndef MULTIPLE_GC
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Wed Aug 13 09:11:28 2008
@@ -17,9 +17,9 @@
#include "JavaClass.h"
#include "JavaConstantPool.h"
#include "JavaJIT.h"
-#include "JavaRuntime.h"
#include "JavaThread.h"
#include "Jnjvm.h"
+#include "JnjvmModule.h"
#include "JnjvmModuleProvider.h"
using namespace llvm;
@@ -41,7 +41,7 @@
meth->compiledPtr();
- LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(meth);
+ LLVMMethodInfo* LMI = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
ctpInfo->ctpRes[index] = LMI->getMethod();
return meth;
@@ -92,7 +92,7 @@
mvm::jit::executionEngine->updateGlobalMapping(F, val);
if (isVirtual(meth->access)) {
- LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(meth);
+ LLVMMethodInfo* LMI = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
uint64_t offset = LMI->getOffset()->getZExtValue();
assert(meth->classDef->isResolved() && "Class not resolved");
assert(meth->classDef->virtualVT && "Class has no VT");
@@ -133,7 +133,7 @@
}
Function* JnjvmModuleProvider::parseFunction(JavaMethod* meth) {
- LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(meth);
+ LLVMMethodInfo* LMI = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
Function* func = LMI->getMethod();
if (func->hasNotBeenReadFromBitcode()) {
// We are jitting. Take the lock.
@@ -141,7 +141,7 @@
JavaJIT jit;
jit.compilingClass = meth->classDef;
jit.compilingMethod = meth;
- jit.module = TheModule;
+ jit.module = (JnjvmModule*)TheModule;
jit.llvmFunction = func;
if (isNative(meth->access)) {
jit.nativeCompile();
@@ -156,7 +156,8 @@
llvm::Function* JnjvmModuleProvider::addCallback(Class* cl, uint32 index,
Signdef* sign, bool stat) {
const llvm::FunctionType* type = 0;
- LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(sign);
+ JnjvmModule* M = cl->isolate->TheModule;
+ LLVMSignatureInfo* LSI = M->getSignatureInfo(sign);
if (stat) {
type = LSI->getStaticType();
@@ -224,7 +225,7 @@
addPass(PM, createSCCPPass()); // Constant prop with SCCP
addPass(PM, createCFGSimplificationPass()); // Merge & remove BBs
- addPass(PM, mvm::createEscapeAnalysisPass(JavaRuntime::JavaObjectAllocateFunction));
+ addPass(PM, mvm::createEscapeAnalysisPass(JnjvmModule::JavaObjectAllocateFunction));
addPass(PM, mvm::createLowerConstantCallsPass());
addPass(PM, createGVNPass()); // Remove redundancies
@@ -240,7 +241,7 @@
}
-JnjvmModuleProvider::JnjvmModuleProvider(llvm::Module *m) {
+JnjvmModuleProvider::JnjvmModuleProvider(JnjvmModule *m) {
TheModule = (Module*)m;
mvm::jit::protectEngine->lock();
mvm::jit::executionEngine->addModuleProvider(this);
Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h Wed Aug 13 09:11:28 2008
@@ -15,12 +15,13 @@
using namespace llvm;
namespace llvm {
- class FunctionPassManager;
- class Module;
+class FunctionPassManager;
}
namespace jnjvm {
+class JnjvmModule;
+
class JnjvmModuleProvider : public ModuleProvider {
private:
JavaMethod* staticLookup(Class* caller, uint32 index);
@@ -41,7 +42,7 @@
public:
- JnjvmModuleProvider(llvm::Module *m);
+ JnjvmModuleProvider(JnjvmModule *m);
~JnjvmModuleProvider();
llvm::Function* addCallback(Class* cl, uint32 index, Signdef* sign,
Modified: vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp?rev=54734&r1=54733&r2=54734&view=diff
==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp Wed Aug 13 09:11:28 2008
@@ -16,7 +16,7 @@
#include "mvm/JIT.h"
-#include "JavaRuntime.h"
+#include "JnjvmModule.h"
using namespace llvm;
using namespace jnjvm;
@@ -44,20 +44,20 @@
II++;
if (CallInst *CI = dyn_cast<CallInst>(I)) {
Value* V = CI->getOperand(0);
- if (V == jnjvm::JavaRuntime::ArrayLengthFunction) {
+ if (V == jnjvm::JnjvmModule::ArrayLengthFunction) {
Changed = true;
Value* val = CI->getOperand(1); // get the array
- Value* array = new BitCastInst(val, jnjvm::JavaRuntime::JavaArrayType,
+ Value* array = new BitCastInst(val, jnjvm::JnjvmModule::JavaArrayType,
"", CI);
std::vector<Value*> args; //size= 2
args.push_back(mvm::jit::constantZero);
- args.push_back(jnjvm::JavaRuntime::JavaArraySizeOffsetConstant);
+ args.push_back(jnjvm::JnjvmModule::JavaArraySizeOffsetConstant);
Value* ptr = GetElementPtrInst::Create(array, args.begin(), args.end(),
"", CI);
Value* load = new LoadInst(ptr, "", CI);
CI->replaceAllUsesWith(load);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetVTFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetVTFunction) {
Changed = true;
Value* val = CI->getOperand(1); // get the object
std::vector<Value*> indexes; //[3];
@@ -68,66 +68,66 @@
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetClassFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetClassFunction) {
Changed = true;
Value* val = CI->getOperand(1); // get the object
std::vector<Value*> args2;
args2.push_back(mvm::jit::constantZero);
- args2.push_back(jnjvm::JavaRuntime::JavaObjectClassOffsetConstant);
+ args2.push_back(jnjvm::JnjvmModule::JavaObjectClassOffsetConstant);
Value* classPtr = GetElementPtrInst::Create(val, args2.begin(),
args2.end(), "",
CI);
Value* cl = new LoadInst(classPtr, "", CI);
CI->replaceAllUsesWith(cl);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetVTFromClassFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetVTFromClassFunction) {
Changed = true;
Value* val = CI->getOperand(1);
std::vector<Value*> indexes;
indexes.push_back(mvm::jit::constantZero);
- indexes.push_back(jnjvm::JavaRuntime::OffsetVTInClassConstant);
+ indexes.push_back(jnjvm::JnjvmModule::OffsetVTInClassConstant);
Value* VTPtr = GetElementPtrInst::Create(val, indexes.begin(),
indexes.end(), "", CI);
Value* VT = new LoadInst(VTPtr, "", CI);
CI->replaceAllUsesWith(VT);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetObjectSizeFromClassFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetObjectSizeFromClassFunction) {
Changed = true;
Value* val = CI->getOperand(1);
std::vector<Value*> indexes;
indexes.push_back(mvm::jit::constantZero);
- indexes.push_back(JavaRuntime::OffsetObjectSizeInClassConstant);
+ indexes.push_back(JnjvmModule::OffsetObjectSizeInClassConstant);
Value* SizePtr = GetElementPtrInst::Create(val, indexes.begin(),
indexes.end(), "", CI);
Value* Size = new LoadInst(SizePtr, "", CI);
CI->replaceAllUsesWith(Size);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::ForceInitialisationCheckFunction) {
+ } else if (V == jnjvm::JnjvmModule::ForceInitialisationCheckFunction) {
Changed = true;
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetDepthFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetDepthFunction) {
Changed = true;
Value* val = CI->getOperand(1);
std::vector<Value*> indexes;
indexes.push_back(mvm::jit::constantZero);
- indexes.push_back(JavaRuntime::OffsetDepthInClassConstant);
+ indexes.push_back(JnjvmModule::OffsetDepthInClassConstant);
Value* DepthPtr = GetElementPtrInst::Create(val, indexes.begin(),
indexes.end(), "", CI);
Value* Depth = new LoadInst(DepthPtr, "", CI);
CI->replaceAllUsesWith(Depth);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetDisplayFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetDisplayFunction) {
Changed = true;
Value* val = CI->getOperand(1);
std::vector<Value*> indexes;
indexes.push_back(mvm::jit::constantZero);
- indexes.push_back(JavaRuntime::OffsetDisplayInClassConstant);
+ indexes.push_back(JnjvmModule::OffsetDisplayInClassConstant);
Value* DisplayPtr = GetElementPtrInst::Create(val, indexes.begin(),
indexes.end(), "", CI);
Value* Display = new LoadInst(DisplayPtr, "", CI);
CI->replaceAllUsesWith(Display);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::GetClassInDisplayFunction) {
+ } else if (V == jnjvm::JnjvmModule::GetClassInDisplayFunction) {
Changed = true;
Value* val = CI->getOperand(1);
Value* depth = CI->getOperand(2);
@@ -135,7 +135,7 @@
Value* Class = new LoadInst(ClassPtr, "", CI);
CI->replaceAllUsesWith(Class);
CI->eraseFromParent();
- } else if (V == jnjvm::JavaRuntime::InstanceOfFunction) {
+ } else if (V == jnjvm::JnjvmModule::InstanceOfFunction) {
ConstantExpr* CE = dyn_cast<ConstantExpr>(CI->getOperand(2));
if (CE) {
ConstantInt* C = (ConstantInt*)CE->getOperand(0);
@@ -145,21 +145,21 @@
I->getParent()->getTerminator()->eraseFromParent();
Value* obj = CI->getOperand(1);
Instruction* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
- JavaRuntime::JavaObjectNullConstant,
+ JnjvmModule::JavaObjectNullConstant,
"", CI);
BasicBlock* ifTrue = BasicBlock::Create("", &F);
BasicBlock* ifFalse = BasicBlock::Create("", &F);
BranchInst::Create(ifTrue, ifFalse, cmp, CI);
PHINode* node = PHINode::Create(Type::Int1Ty, "", ifTrue);
node->addIncoming(ConstantInt::getFalse(), CI->getParent());
- Value* objCl = CallInst::Create(JavaRuntime::GetClassFunction, obj,
+ Value* objCl = CallInst::Create(JnjvmModule::GetClassFunction, obj,
"", ifFalse);
if (isInterface(cl->access)) {
std::vector<Value*> args;
args.push_back(objCl);
args.push_back(CE);
- Value* res = CallInst::Create(JavaRuntime::ImplementsFunction,
+ Value* res = CallInst::Create(JnjvmModule::ImplementsFunction,
args.begin(), args.end(), "",
ifFalse);
node->addIncoming(res, ifFalse);
@@ -174,7 +174,7 @@
std::vector<Value*> args;
args.push_back(objCl);
args.push_back(CE);
- cmp = CallInst::Create(JavaRuntime::IsAssignableFromFunction,
+ cmp = CallInst::Create(JnjvmModule::IsAssignableFromFunction,
args.begin(), args.end(), "", notEquals);
node->addIncoming(cmp, notEquals);
BranchInst::Create(ifTrue, notEquals);
@@ -183,7 +183,7 @@
args.push_back(objCl);
args.push_back(CE);
Value* res =
- CallInst::Create(JavaRuntime::InstantiationOfArrayFunction,
+ CallInst::Create(JnjvmModule::InstantiationOfArrayFunction,
args.begin(), args.end(), "", notEquals);
node->addIncoming(res, notEquals);
BranchInst::Create(ifTrue, notEquals);
@@ -192,10 +192,10 @@
if (cl->isResolved()) {
depthCl = ConstantInt::get(Type::Int32Ty, cl->depth);
} else {
- depthCl = CallInst::Create(JavaRuntime::GetDepthFunction,
+ depthCl = CallInst::Create(JnjvmModule::GetDepthFunction,
CE, "", notEquals);
}
- Value* depthClObj = CallInst::Create(JavaRuntime::GetDepthFunction,
+ Value* depthClObj = CallInst::Create(JnjvmModule::GetDepthFunction,
objCl, "", notEquals);
Value* cmp = new ICmpInst(ICmpInst::ICMP_ULE, depthCl, depthClObj, "",
notEquals);
@@ -206,14 +206,14 @@
node->addIncoming(ConstantInt::getFalse(), notEquals);
Value* inDisplay =
- CallInst::Create(JavaRuntime::GetDisplayFunction, objCl,
+ CallInst::Create(JnjvmModule::GetDisplayFunction, objCl,
"", supDepth);
std::vector<Value*> args;
args.push_back(inDisplay);
args.push_back(depthCl);
Value* clInDisplay =
- CallInst::Create(JavaRuntime::GetClassInDisplayFunction,
+ CallInst::Create(JnjvmModule::GetClassInDisplayFunction,
args.begin(), args.end(), "", supDepth);
cmp = new ICmpInst(ICmpInst::ICMP_EQ, clInDisplay, CE, "",
@@ -229,7 +229,7 @@
}
}
#ifdef MULTIPLE_GC
- else if (V == jnjvm::JavaRuntime::GetCollectorFunction) {
+ else if (V == jnjvm::JnjvmModule::GetCollectorFunction) {
Changed = true;
Value* val = CI->getOperand(1);
std::vector<Value*> indexes;
More information about the vmkit-commits
mailing list