[vmkit-commits] [vmkit] r54732 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaClass.cpp JavaConstantPool.cpp JavaIsolate.cpp JavaJIT.cpp JavaJIT.h JavaJITOpcodes.cpp JavaMetaJIT.cpp 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 06:13:16 PDT 2008


Author: geoffray
Date: Wed Aug 13 08:13:05 2008
New Revision: 54732

URL: http://llvm.org/viewvc/llvm-project?rev=54732&view=rev
Log:
Having a custom made Module for Jnjvm does not add a thing. Just
use the basic llvm::Module. All runtime functions are now in the
JavaRuntime class.


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/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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Wed Aug 13 08:13:05 2008
@@ -508,25 +508,25 @@
   Attribut* attribut = lookupAttribut(Attribut::constantAttribut);
 
   if (!attribut) {
-    JnjvmModule::InitField(this, obj);
+    JavaRuntime::InitField(this, obj);
   } else {
     Reader reader(attribut, classDef->bytes);
     JavaCtpInfo * ctpInfo = classDef->ctpInfo;
     uint16 idx = reader.readU2();
     if (funcs == AssessorDesc::dLong) {
-      JnjvmModule::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
+      JavaRuntime::InitField(this, obj, (uint64)ctpInfo->LongAt(idx));
     } else if (funcs == AssessorDesc::dDouble) {
-      JnjvmModule::InitField(this, obj, ctpInfo->DoubleAt(idx));
+      JavaRuntime::InitField(this, obj, ctpInfo->DoubleAt(idx));
     } else if (funcs == AssessorDesc::dFloat) {
-      JnjvmModule::InitField(this, obj, ctpInfo->FloatAt(idx));
+      JavaRuntime::InitField(this, obj, ctpInfo->FloatAt(idx));
     } else if (funcs == AssessorDesc::dRef) {
       const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[idx]);
-      JnjvmModule::InitField(this, obj,
+      JavaRuntime::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) {
-      JnjvmModule::InitField(this, obj, (uint64)ctpInfo->IntegerAt(idx));
+      JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaConstantPool.cpp Wed Aug 13 08:13:05 2008
@@ -419,8 +419,7 @@
       cl->lookupMethodDontThrow(utf8, sign->keyName, isStatic(access), false);
     if (meth) { 
       // don't throw if no meth, the exception will be thrown just in time
-      JnjvmModule* M = classDef->isolate->TheModule;
-      void* F = M->getMethod(meth);
+      void* F = JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaIsolate.cpp Wed Aug 13 08:13:05 2008
@@ -449,7 +449,10 @@
   
   isolate->analyseClasspathEnv(isolate->bootClasspathEnv);
 
-  isolate->TheModule = new JnjvmModule("Isolate JnJVM");
+  isolate->TheModule = new llvm::Module("Isolate JnJVM");
+   std::string str = 
+    mvm::jit::executionEngine->getTargetData()->getStringRepresentation();
+  isolate->TheModule->setDataLayout(str);
   isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->TheModule);
   
   isolate->bootstrapThread = vm_new(isolate, JavaThread)();
@@ -509,8 +512,11 @@
   
   isolate->analyseClasspathEnv(isolate->bootClasspathEnv);
   
-  isolate->TheModule = new JnjvmModule("Bootstrap JnJVM");
-  isolate->TheModule->initialise();
+  isolate->TheModule = new llvm::Module("Bootstrap JnJVM");
+  std::string str = 
+    mvm::jit::executionEngine->getTargetData()->getStringRepresentation();
+  isolate->TheModule->setDataLayout(str);
+  JavaRuntime::initialise(isolate->TheModule);
   isolate->TheModuleProvider = new JnjvmModuleProvider(isolate->TheModule);
  
   isolate->bootstrapThread = vm_new(isolate, JavaThread)();

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp?rev=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Wed Aug 13 08:13:05 2008
@@ -38,7 +38,6 @@
 #include "JavaTypes.h"
 #include "JavaUpcalls.h"
 #include "Jnjvm.h"
-#include "JnjvmModuleProvider.h"
 #include "NativeUtil.h"
 #include "Reader.h"
 #include "Zip.h"
@@ -66,18 +65,18 @@
   Constant* zero = mvm::jit::constantZero;
   Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
   std::vector<Value*> args; // size = [signature->nbIn + 3];
-  LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
+  LLVMSignatureInfo* LSI = JavaRuntime::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(JnjvmModule::GetVTFunction, args[0], "",
+  Value* VT = CallInst::Create(JavaRuntime::GetVTFunction, args[0], "",
                                currentBlock);
   std::vector<Value*> indexes2; //[3];
   if (meth) {
-    LLVMMethodInfo* LMI = module->getMethodInfo(meth);
+    LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(meth);
     indexes2.push_back(LMI->getOffset());
   } else {
     GlobalVariable* gv = 
@@ -101,12 +100,12 @@
     std::vector<Value*> Args;
     Args.push_back(args[0]);
     LLVMClassInfo* LCI = 
-      (LLVMClassInfo*)module->getClassInfo(compilingClass);
+      (LLVMClassInfo*)JavaRuntime::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(JnjvmModule::VirtualLookupFunction, Args, "", currentBlock);
+    val = invoke(JavaRuntime::VirtualLookupFunction, Args, "", currentBlock);
     node->addIncoming(val, currentBlock);
     llvm::BranchInst::Create(endBlock, currentBlock);
     
@@ -176,7 +175,7 @@
   } else {
     JavaObject* loader = compilingClass->classLoader;
     ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
-    LLVMServiceInfo* LSI = module->getServiceInfo(vm);
+    LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
     isolateLocal = LSI->getDelegatee(this);
     Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, lastArg, 
                               isolateLocal, "", currentBlock);
@@ -187,7 +186,7 @@
     std::vector<Value*> Args;
     Args.push_back(lastArg);
     Args.push_back(isolateLocal);
-    CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
+    CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
                      Args.end(), "", currentBlock);
     BranchInst::Create(endBlock, currentBlock);
     currentBlock = endBlock;
@@ -198,7 +197,7 @@
   if (funcType->getReturnType() != Type::VoidTy)
     endNode = llvm::PHINode::Create(funcType->getReturnType(), "", endBlock);
   
-  Value* buf = llvm::CallInst::Create(JnjvmModule::GetSJLJBufferFunction,
+  Value* buf = llvm::CallInst::Create(JavaRuntime::GetSJLJBufferFunction,
                                       "", currentBlock);
   Value* test = llvm::CallInst::Create(mvm::jit::setjmpLLVM, buf, "",
                                        currentBlock);
@@ -229,7 +228,7 @@
   uint32 index = 0;
   if (stat) {
     LLVMClassInfo* LCI = 
-      (LLVMClassInfo*)module->getClassInfo(compilingClass);
+      (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
     nativeArgs.push_back(LCI->getDelegatee(this));
     index = 2;
   } else {
@@ -243,7 +242,7 @@
   
   
   LLVMSignatureInfo* LSI = 
-    module->getSignatureInfo(compilingMethod->getSignature());
+    JavaRuntime::getSignatureInfo(compilingMethod->getSignature());
   const llvm::Type* valPtrType = LSI->getNativePtrType();
   Value* valPtr = 
     ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty, (uint64)natPtr),
@@ -260,7 +259,7 @@
   if (isSynchro(compilingMethod->access))
     endSynchronize();
   
-  llvm::CallInst::Create(JnjvmModule::JniProceedPendingExceptionFunction, "",
+  llvm::CallInst::Create(JavaRuntime::JniProceedPendingExceptionFunction, "",
                          currentBlock);
   
   if (funcType->getReturnType() != Type::VoidTy)
@@ -279,10 +278,10 @@
 void JavaJIT::monitorEnter(Value* obj) {
   std::vector<Value*> gep;
   gep.push_back(mvm::jit::constantZero);
-  gep.push_back(JnjvmModule::JavaObjectLockOffsetConstant);
+  gep.push_back(JavaRuntime::JavaObjectLockOffsetConstant);
   Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
                                              currentBlock);
-  Value* threadId = CallInst::Create(JnjvmModule::GetThreadIDFunction, "",
+  Value* threadId = CallInst::Create(JavaRuntime::GetThreadIDFunction, "",
                                      currentBlock);
   std::vector<Value*> atomicArgs;
   atomicArgs.push_back(lockPtr);
@@ -348,14 +347,14 @@
 
   // The counter will overflow, call this function to create a new lock,
   // lock it 0x101 times, and pass.
-  CallInst::Create(JnjvmModule::OverflowThinLockFunction, obj, "",
+  CallInst::Create(JavaRuntime::OverflowThinLockFunction, obj, "",
                    currentBlock);
   BranchInst::Create(OK, currentBlock);
   
   currentBlock = FatLockBB;
 
   // Either it's a fat lock or there is contention.
-  CallInst::Create(JnjvmModule::AquireObjectFunction, obj, "", currentBlock);
+  CallInst::Create(JavaRuntime::AquireObjectFunction, obj, "", currentBlock);
   BranchInst::Create(OK, currentBlock);
   currentBlock = OK;
 }
@@ -363,11 +362,11 @@
 void JavaJIT::monitorExit(Value* obj) {
   std::vector<Value*> gep;
   gep.push_back(mvm::jit::constantZero);
-  gep.push_back(JnjvmModule::JavaObjectLockOffsetConstant);
+  gep.push_back(JavaRuntime::JavaObjectLockOffsetConstant);
   Value* lockPtr = GetElementPtrInst::Create(obj, gep.begin(), gep.end(), "",
                                              currentBlock);
   Value* lock = new LoadInst(lockPtr, "", currentBlock);
-  Value* threadId = CallInst::Create(JnjvmModule::GetThreadIDFunction, "",
+  Value* threadId = CallInst::Create(JavaRuntime::GetThreadIDFunction, "",
                                      currentBlock);
   
   Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, lock, threadId, "",
@@ -409,7 +408,7 @@
   currentBlock = FatLockBB;
 
   // Either it's a fat lock or there is contention.
-  CallInst::Create(JnjvmModule::ReleaseObjectFunction, obj, "", currentBlock);
+  CallInst::Create(JavaRuntime::ReleaseObjectFunction, obj, "", currentBlock);
   BranchInst::Create(EndUnlock, currentBlock);
   currentBlock = EndUnlock;
 }
@@ -420,17 +419,17 @@
     obj = llvmFunction->arg_begin();
   } else {
     LLVMClassInfo* LCI = 
-      (LLVMClassInfo*)module->getClassInfo(compilingClass);
+      (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
     obj = LCI->getStaticVar(this);
   }
 #ifndef SERVICE_VM
   monitorEnter(obj);
 #else
   if (ServiceDomain::isLockableDomain(compilingClass->isolate)) {
-    llvm::CallInst::Create(JnjvmModule::AquireObjectInSharedDomainFunction,
+    llvm::CallInst::Create(JavaRuntime::AquireObjectInSharedDomainFunction,
                            obj, "", currentBlock);
   } else {
-    llvm::CallInst::Create(JnjvmModule::AquireObjectFunction,
+    llvm::CallInst::Create(JavaRuntime::AquireObjectFunction,
                            obj, "", currentBlock);
   }
 #endif
@@ -442,17 +441,17 @@
     obj = llvmFunction->arg_begin();
   } else {
     LLVMClassInfo* LCI = 
-      (LLVMClassInfo*)module->getClassInfo(compilingClass);
+      (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
     obj = LCI->getStaticVar(this);
   }
 #ifndef SERVICE_VM
   monitorExit(obj);
 #else
   if (ServiceDomain::isLockableDomain(compilingClass->isolate)) {
-    llvm::CallInst::Create(JnjvmModule::ReleaseObjectInSharedDomainFunction,
+    llvm::CallInst::Create(JavaRuntime::ReleaseObjectInSharedDomainFunction,
                            argsSync.begin(), argsSync.end(), "", currentBlock);
   } else {
-    llvm::CallInst::Create(JnjvmModule::ReleaseObjectFunction, argsSync.begin(),
+    llvm::CallInst::Create(JavaRuntime::ReleaseObjectFunction, argsSync.begin(),
                            argsSync.end(), "", currentBlock);    
   }
 #endif
@@ -483,7 +482,7 @@
   
   reader.seek(codeLen, Reader::SeekCur);
   
-  LLVMMethodInfo* LMI = module->getMethodInfo(compilingMethod);
+  LLVMMethodInfo* LMI = JavaRuntime::getMethodInfo(compilingMethod);
   assert(LMI);
   Function* func = LMI->getMethod();
   llvmFunction = parentFunction;
@@ -507,7 +506,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(JnjvmModule::JavaObjectType, "",
+    objectLocals.push_back(new AllocaInst(JavaRuntime::JavaObjectType, "",
                                           currentBlock));
   }
   
@@ -563,7 +562,7 @@
   } else {
     JavaObject* loader = compilingClass->classLoader;
     ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
-    LLVMServiceInfo* LSI = module->getServiceInfo(vm);
+    LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
     isolateLocal = LSI->getDelegatee(this);
     Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, args[args.size() - 1], 
                               isolateLocal, "", currentBlock);
@@ -574,7 +573,7 @@
     std::vector<Value*> Args;
     Args.push_back(args[args.size()-  1]);
     Args.push_back(isolateLocal);
-    CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
+    CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
                      Args.end(), "", currentBlock);
     BranchInst::Create(endBlock, currentBlock);
     currentBlock = endBlock;
@@ -605,7 +604,7 @@
     std::vector<Value*> Args;
     Args.push_back(args[args.size() - 1]);
     Args.push_back(isolateLocal);
-    CallInst::Create(JnjvmModule::ServiceCallStopFunction, Args.begin(),
+    CallInst::Create(JavaRuntime::ServiceCallStopFunction, Args.begin(),
                      Args.end(), "", currentBlock);
     BranchInst::Create(newEndBlock, currentBlock);
     currentBlock = newEndBlock;
@@ -659,7 +658,7 @@
     {
     std::vector<llvm::Value*> args;
     args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
-    llvm::CallInst::Create(JnjvmModule::PrintMethodStartFunction, args.begin(),
+    llvm::CallInst::Create(JavaRuntime::PrintMethodStartFunction, args.begin(),
                            args.end(), "", currentBlock);
     }
 #endif
@@ -671,7 +670,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(JnjvmModule::JavaObjectType, "",
+    objectLocals.push_back(new AllocaInst(JavaRuntime::JavaObjectType, "",
                                           currentBlock));
   }
   
@@ -726,7 +725,7 @@
   } else {
     JavaObject* loader = compilingClass->classLoader;
     ServiceDomain* vm = ServiceDomain::getDomainFromLoader(loader);
-    LLVMServiceInfo* LSI = module->getServiceInfo(vm);
+    LLVMServiceInfo* LSI = JavaRuntime::getServiceInfo(vm);
     isolateLocal = LSI->getDelegatee(this);
     Value* cmp = new ICmpInst(ICmpInst::ICMP_NE, i, isolateLocal, "",
                               currentBlock);
@@ -737,7 +736,7 @@
     std::vector<Value*> Args;
     Args.push_back(i);
     Args.push_back(isolateLocal);
-    CallInst::Create(JnjvmModule::ServiceCallStartFunction, Args.begin(),
+    CallInst::Create(JavaRuntime::ServiceCallStartFunction, Args.begin(),
                      Args.end(), "", currentBlock);
     BranchInst::Create(endBlock, currentBlock);
     currentBlock = endBlock;
@@ -783,7 +782,7 @@
     {
     std::vector<llvm::Value*> args;
     args.push_back(ConstantInt::get(Type::Int32Ty, (int64_t)compilingMethod));
-    llvm::CallInst::Create(JnjvmModule::PrintMethodEndFunction, args.begin(),
+    llvm::CallInst::Create(JavaRuntime::PrintMethodEndFunction, args.begin(),
                            args.end(), "", currentBlock);
     }
 #endif
@@ -799,7 +798,7 @@
     std::vector<Value*> Args;
     Args.push_back(i);
     Args.push_back(isolateLocal);
-    CallInst::Create(JnjvmModule::ServiceCallStopFunction, Args.begin(),
+    CallInst::Create(JavaRuntime::ServiceCallStopFunction, Args.begin(),
                      Args.end(), "", currentBlock);
     BranchInst::Create(newEndBlock, currentBlock);
     currentBlock = newEndBlock;
@@ -816,7 +815,7 @@
   if (PI == PE) {
     endExceptionBlock->eraseFromParent();
   } else {
-    CallInst* ptr_eh_ptr = CallInst::Create(JnjvmModule::GetExceptionFunction,
+    CallInst* ptr_eh_ptr = CallInst::Create(JavaRuntime::GetExceptionFunction,
                                             "eh_ptr", endExceptionBlock);
     llvm::CallInst::Create(mvm::jit::unwindResume, ptr_eh_ptr, "",
                            endExceptionBlock);
@@ -851,7 +850,7 @@
   nbe += sync;
   JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
   if (nbe) {
-    supplLocal = new AllocaInst(JnjvmModule::JavaObjectType, "exceptionVar",
+    supplLocal = new AllocaInst(JavaRuntime::JavaObjectType, "exceptionVar",
                                 currentBlock);
   }
   
@@ -869,11 +868,11 @@
     if (isVirtual(compilingMethod->access)) {
       argsSync.push_back(llvmFunction->arg_begin());
     } else {
-      LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
+      LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
       Value* arg = LCI->getStaticVar(this);
       argsSync.push_back(arg);
     }
-    llvm::CallInst::Create(JnjvmModule::ReleaseObjectFunction, argsSync.begin(), argsSync.end(),
+    llvm::CallInst::Create(JavaRuntime::ReleaseObjectFunction, argsSync.begin(), argsSync.end(),
                            "", synchronizeExceptionBlock);
 
     llvm::BranchInst::Create(endExceptionBlock, synchronizeExceptionBlock);
@@ -1027,9 +1026,9 @@
     Value* cl = 0;
     currentBlock = cur->realTest;
     assert(cur->catchClass);
-    LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cur->catchClass);
+    LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(cur->catchClass);
     cl = LCI->getVar(this);
-    Value* cmp = llvm::CallInst::Create(JnjvmModule::CompareExceptionFunction, cl, "",
+    Value* cmp = llvm::CallInst::Create(JavaRuntime::CompareExceptionFunction, cl, "",
                                         currentBlock);
     llvm::BranchInst::Create(cur->handler, bbNext, cmp, currentBlock);
     if (nodeNext)
@@ -1039,9 +1038,9 @@
       cur->handlerPHI = llvm::PHINode::Create(mvm::jit::ptrType, "",
                                               cur->handler);
       cur->handlerPHI->addIncoming(cur->exceptionPHI, currentBlock);
-      Value* exc = llvm::CallInst::Create(JnjvmModule::GetJavaExceptionFunction,
+      Value* exc = llvm::CallInst::Create(JavaRuntime::GetJavaExceptionFunction,
                                           "", cur->handler);
-      llvm::CallInst::Create(JnjvmModule::ClearExceptionFunction, "",
+      llvm::CallInst::Create(JavaRuntime::ClearExceptionFunction, "",
                              cur->handler);
       llvm::CallInst::Create(mvm::jit::exceptionBeginCatch, cur->handlerPHI,
                              "tmp8", cur->handler);
@@ -1098,16 +1097,16 @@
 #ifndef MULTIPLE_VM
         val = compilingClass->isolate->UTF8ToStr(utf8);
         gv =
-          new GlobalVariable(JnjvmModule::JavaObjectType, false, 
+          new GlobalVariable(JavaRuntime::JavaObjectType, false, 
                              GlobalValue::ExternalLinkage,
-                             JnjvmModule::JavaObjectNullConstant, "",
+                             JavaRuntime::JavaObjectNullConstant, "",
                              module);
 #else
           val = (void*)utf8;
           gv =
-            new GlobalVariable(JnjvmModule::JavaArrayUInt16Type, false, 
+            new GlobalVariable(JavaRuntime::JavaArrayUInt16Type, false, 
                                GlobalValue::ExternalLinkage,
-                               JnjvmModule::UTF8NullConstant, "",
+                               JavaRuntime::UTF8NullConstant, "",
                                module);
 #endif
         
@@ -1116,7 +1115,7 @@
         GenericValue Val = GenericValue(val);
         llvm::GenericValue * Ptr = (llvm::GenericValue*)ptr;
         mvm::jit::executionEngine->StoreValueToMemory(Val, Ptr,
-                                                  JnjvmModule::JavaObjectType);
+                                                  JavaRuntime::JavaObjectType);
         toPush = new LoadInst(gv, "", currentBlock);
         ctpInfo->ctpRes[index] = gv;
         compilingClass->release();
@@ -1130,7 +1129,7 @@
                             currentBlock);
     }
 #ifdef MULTIPLE_VM
-    CallInst* C = llvm::CallInst::Create(JnjvmModule::RuntimeUTF8ToStrFunction,
+    CallInst* C = llvm::CallInst::Create(JavaRuntime::RuntimeUTF8ToStrFunction,
                                          toPush, "", currentBlock);
     push(C, AssessorDesc::dRef);
 #else
@@ -1151,11 +1150,11 @@
   } else if (type == JavaCtpInfo::ConstantClass) {
     if (ctpInfo->ctpRes[index]) {
       CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
-      LLVMCommonClassInfo* LCI = module->getClassInfo(cl);
+      LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(cl);
       push(LCI->getDelegatee(this), AssessorDesc::dRef);
     } else {
       Value* val = getResolvedClass(index, false);
-      Value* res = CallInst::Create(JnjvmModule::GetClassDelegateeFunction, val, "",
+      Value* res = CallInst::Create(JavaRuntime::GetClassDelegateeFunction, val, "",
                                     currentBlock);
       push(res, AssessorDesc::dRef);
     }
@@ -1167,7 +1166,7 @@
 void JavaJIT::JITVerifyNull(Value* obj) { 
 
   JavaJIT* jit = this;
-  Constant* zero = JnjvmModule::JavaObjectNullConstant;
+  Constant* zero = JavaRuntime::JavaObjectNullConstant;
   Value* test = new ICmpInst(ICmpInst::ICMP_EQ, obj, zero, "",
                              jit->currentBlock);
 
@@ -1177,12 +1176,12 @@
   llvm::BranchInst::Create(exit, cont, test, jit->currentBlock);
   std::vector<Value*> args;
   if (currentExceptionBlock != endExceptionBlock) {
-    llvm::InvokeInst::Create(JnjvmModule::NullPointerExceptionFunction,
+    llvm::InvokeInst::Create(JavaRuntime::NullPointerExceptionFunction,
                              unifiedUnreachable,
                              currentExceptionBlock, args.begin(),
                              args.end(), "", exit);
   } else {
-    llvm::CallInst::Create(JnjvmModule::NullPointerExceptionFunction,
+    llvm::CallInst::Create(JavaRuntime::NullPointerExceptionFunction,
                            args.begin(), args.end(), "", exit);
     new UnreachableInst(exit);
   }
@@ -1215,12 +1214,12 @@
     args.push_back(obj);
     args.push_back(index);
     if (currentExceptionBlock != endExceptionBlock) {
-      llvm::InvokeInst::Create(JnjvmModule::IndexOutOfBoundsExceptionFunction,
+      llvm::InvokeInst::Create(JavaRuntime::IndexOutOfBoundsExceptionFunction,
                                unifiedUnreachable,
                                currentExceptionBlock, args.begin(),
                                args.end(), "", ifFalse);
     } else {
-      llvm::CallInst::Create(JnjvmModule::IndexOutOfBoundsExceptionFunction,
+      llvm::CallInst::Create(JavaRuntime::IndexOutOfBoundsExceptionFunction,
                              args.begin(), args.end(), "", ifFalse);
       new UnreachableInst(ifFalse);
     }
@@ -1233,7 +1232,7 @@
   
   std::vector<Value*> indexes; //[3];
   indexes.push_back(zero);
-  indexes.push_back(JnjvmModule::JavaArrayElementsOffsetConstant);
+  indexes.push_back(JavaRuntime::JavaArrayElementsOffsetConstant);
   indexes.push_back(index);
   Value* ptr = llvm::GetElementPtrInst::Create(val, indexes.begin(),
                                                indexes.end(), 
@@ -1492,7 +1491,7 @@
   const UTF8* name = 0;
   const UTF8* cl = 0;
   ctpInfo->nameOfStaticOrSpecialMethod(index, cl, name, signature);
-  LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
+  LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
   const llvm::FunctionType* virtualType = LSI->getVirtualType();
   llvm::Instruction* val = 0;
   
@@ -1537,7 +1536,7 @@
   const UTF8* name = 0;
   const UTF8* cl = 0;
   ctpInfo->nameOfStaticOrSpecialMethod(index, cl, name, signature);
-  LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
+  LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
   const llvm::FunctionType* staticType = LSI->getStaticType();
   llvm::Instruction* val = 0;
   
@@ -1560,11 +1559,11 @@
     uint32 clIndex = ctpInfo->getClassIndexFromMethod(index);
     Class* mycl = (Class*)(ctpInfo->getMethodClassIfLoaded(clIndex));
     if (mycl && mycl->status >= resolved) {
-      LLVMCommonClassInfo* LCI = module->getClassInfo(mycl);
+      LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(mycl);
       Value* arg = LCI->getVar(this);
-      arg = invoke(JnjvmModule::InitialisationCheckFunction, arg, "",
+      arg = invoke(JavaRuntime::InitialisationCheckFunction, arg, "",
                    currentBlock);
-      CallInst::Create(JnjvmModule::ForceInitialisationCheckFunction, arg, "",
+      CallInst::Create(JavaRuntime::ForceInitialisationCheckFunction, arg, "",
                        currentBlock);
     }
 
@@ -1590,20 +1589,20 @@
     
 Value* JavaJIT::getResolvedClass(uint16 index, bool clinit) {
     GlobalVariable * gv =
-      new GlobalVariable(JnjvmModule::JavaClassType, false, 
+      new GlobalVariable(JavaRuntime::JavaClassType, false, 
                          GlobalValue::ExternalLinkage,
-                         JnjvmModule::JavaClassNullConstant, "",
+                         JavaRuntime::JavaClassNullConstant, "",
                          module);
 
     
     Value* arg1 = new LoadInst(gv, "", false, currentBlock);
     Value* test = new ICmpInst(ICmpInst::ICMP_EQ, arg1, 
-                               JnjvmModule::JavaClassNullConstant, "",
+                               JavaRuntime::JavaClassNullConstant, "",
                                currentBlock);
     
     BasicBlock* trueCl = createBasicBlock("Cl OK");
     BasicBlock* falseCl = createBasicBlock("Cl Not OK");
-    PHINode* node = llvm::PHINode::Create(JnjvmModule::JavaClassType, "",
+    PHINode* node = llvm::PHINode::Create(JavaRuntime::JavaClassType, "",
                                           trueCl);
     node->addIncoming(arg1, currentBlock);
     llvm::BranchInst::Create(falseCl, trueCl, test, currentBlock);
@@ -1611,7 +1610,7 @@
     currentBlock = falseCl;
 
     std::vector<Value*> Args;
-    LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
+    LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(compilingClass);
     Value* v = LCI->getVar(this);
     Args.push_back(v);
     ConstantInt* CI = ConstantInt::get(Type::Int32Ty, index);
@@ -1622,7 +1621,7 @@
     } else {
       Args.push_back(mvm::jit::constantZero);
     }
-    Value* res = invoke(JnjvmModule::ClassLookupFunction, Args, "",
+    Value* res = invoke(JavaRuntime::ClassLookupFunction, Args, "",
                         currentBlock);
     node->addIncoming(res, currentBlock);
 
@@ -1630,7 +1629,7 @@
     currentBlock = trueCl;
 #ifdef MULTIPLE_VM
     if (clinit)
-      return invoke(JnjvmModule::InitialisationCheckFunction, node, "",
+      return invoke(JavaRuntime::InitialisationCheckFunction, node, "",
                     currentBlock);
     else
 #endif
@@ -1647,35 +1646,35 @@
   Value* Cl = 0;
   if (!cl || !cl->isResolved()) {
     Cl = getResolvedClass(index, true);
-    Size = CallInst::Create(JnjvmModule::GetObjectSizeFromClassFunction, Cl,
+    Size = CallInst::Create(JavaRuntime::GetObjectSizeFromClassFunction, Cl,
                             "", currentBlock);
-    VT = CallInst::Create(JnjvmModule::GetVTFromClassFunction, Cl, "",
+    VT = CallInst::Create(JavaRuntime::GetVTFromClassFunction, Cl, "",
                           currentBlock);
   } else {
-    LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(cl);
+    LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(cl);
     Size = LCI->getVirtualSize(this);
     VT = LCI->getVirtualTable(this);
     Cl = LCI->getVar(this);
 #ifndef MULTIPLE_VM
     if (!cl->isReady())
 #endif
-      Cl = invoke(JnjvmModule::InitialisationCheckFunction, Cl, "", currentBlock);
+      Cl = invoke(JavaRuntime::InitialisationCheckFunction, Cl, "", currentBlock);
   }
   std::vector<Value*> args;
   args.push_back(Size);
   args.push_back(VT);
 #ifdef MULTIPLE_GC
-  args.push_back(CallInst::Create(JnjvmModule::GetCollectorFunction,
+  args.push_back(CallInst::Create(JavaRuntime::GetCollectorFunction,
                                   isolateLocal, "", currentBlock));
 #endif
-  Value* val = invoke(JnjvmModule::JavaObjectAllocateFunction, args, "",
+  Value* val = invoke(JavaRuntime::JavaObjectAllocateFunction, args, "",
                       currentBlock);
   
   // Set the class
   
   std::vector<Value*> gep;
   gep.push_back(mvm::jit::constantZero);
-  gep.push_back(JnjvmModule::JavaObjectClassOffsetConstant);
+  gep.push_back(JavaRuntime::JavaObjectClassOffsetConstant);
   Value* GEP = GetElementPtrInst::Create(val, gep.begin(), gep.end(), "",
                                          currentBlock);
   new StoreInst(Cl, GEP, currentBlock);
@@ -1685,7 +1684,7 @@
 }
 
 Value* JavaJIT::arraySize(Value* val) {
-  return llvm::CallInst::Create(JnjvmModule::ArrayLengthFunction, val, "",
+  return llvm::CallInst::Create(JavaRuntime::ArrayLengthFunction, val, "",
                                 currentBlock);
 }
 
@@ -1715,13 +1714,13 @@
       && field->classDef->isReady()
 #endif
      ) {
-    LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(field->classDef);
+    LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::getClassInfo(field->classDef);
     if (stat) {
       object = LCI->getStaticVar(this);
     }
     const Type* type = stat ? LCI->getStaticType() :
                               LCI->getVirtualType();
-    LLVMFieldInfo* LFI = module->getFieldInfo(field);
+    LLVMFieldInfo* LFI = JavaRuntime::getFieldInfo(field);
     return fieldGetter(this, type, object, LFI->getOffset());
   } else {
     const Type* Pty = mvm::jit::arrayPtrType;
@@ -1770,16 +1769,16 @@
     if (object) {
       args.push_back(object);
     } else {
-      args.push_back(JnjvmModule::JavaObjectNullConstant);
+      args.push_back(JavaRuntime::JavaObjectNullConstant);
     }
-    LLVMClassInfo* LCI = (LLVMClassInfo*)module->getClassInfo(compilingClass);
+    LLVMClassInfo* LCI = (LLVMClassInfo*)JavaRuntime::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(JnjvmModule::FieldLookupFunction, args, "", currentBlock);
+    Value* tmp = invoke(JavaRuntime::FieldLookupFunction, args, "", currentBlock);
     node->addIncoming(tmp, currentBlock);
     llvm::BranchInst::Create(endBlock, currentBlock);
     
@@ -1962,7 +1961,7 @@
   JavaCtpInfo* ctpInfo = compilingClass->ctpInfo;
   Signdef* signature = ctpInfo->infoOfInterfaceOrVirtualMethod(index);
   
-  LLVMSignatureInfo* LSI = module->getSignatureInfo(signature);
+  LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(signature);
   const llvm::FunctionType* virtualType = LSI->getVirtualType();
   const llvm::PointerType* virtualPtrType = LSI->getVirtualPtrType();
 
@@ -1988,7 +1987,7 @@
   Value* llvmEnv = 
     ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
                               uint64_t (enveloppe)),
-                              JnjvmModule::EnveloppeType);
+                              JavaRuntime::EnveloppeType);
   
 
   JITVerifyNull(args[0]);
@@ -2000,7 +1999,7 @@
                                           "", currentBlock);
   Value* cache = new LoadInst(cachePtr, "", currentBlock);
 
-  Value* cl = CallInst::Create(JnjvmModule::GetClassFunction, args[0], "",
+  Value* cl = CallInst::Create(JavaRuntime::GetClassFunction, args[0], "",
                                currentBlock);
   std::vector<Value*> args3;
   args3.push_back(zero);
@@ -2017,7 +2016,7 @@
   BranchInst::Create(ifTrue, ifFalse, cmp, currentBlock);
   
   currentBlock = ifFalse;
-  Value* _meth = invoke(JnjvmModule::InterfaceLookupFunction, cache, args[0],
+  Value* _meth = invoke(JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.h Wed Aug 13 08:13:05 2008
@@ -17,6 +17,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Function.h"
 #include "llvm/Instructions.h"
+#include "llvm/Module.h"
 #include "llvm/Value.h"
 
 #include "types.h"
@@ -25,7 +26,7 @@
 #include "mvm/PrintBuffer.h"
 
 #include "JavaTypes.h"
-#include "JnjvmModule.h"
+#include "JavaRuntime.h"
 
 namespace jnjvm {
 
@@ -58,7 +59,7 @@
 class JavaJIT {
 public:
   
-  JnjvmModule* module;
+  llvm::Module* 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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Wed Aug 13 08:13:05 2008
@@ -30,6 +30,7 @@
 #include "JavaConstantPool.h"
 #include "JavaObject.h"
 #include "JavaJIT.h"
+#include "JavaRuntime.h"
 #include "JavaThread.h"
 #include "JavaTypes.h"
 #include "Jnjvm.h"
@@ -130,7 +131,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(JnjvmModule::PrintExecutionFunction, args.begin(),
+    CallInst::Create(JavaRuntime::PrintExecutionFunction, args.begin(),
                      args.end(), "", currentBlock);
     }
 #endif
@@ -142,7 +143,7 @@
     switch (bytecodes[i]) {
       
       case ACONST_NULL : 
-        push(JnjvmModule::JavaObjectNullConstant, AssessorDesc::dRef);
+        push(JavaRuntime::JavaObjectNullConstant, AssessorDesc::dRef);
         break;
 
       case ICONST_M1 :
@@ -365,7 +366,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index, 
-                                         JnjvmModule::JavaArraySInt32Type);
+                                         JavaRuntime::JavaArraySInt32Type);
         push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dInt);
         break;
       }
@@ -374,7 +375,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayLongType);
+                                         JavaRuntime::JavaArrayLongType);
         push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dLong);
         push(mvm::jit::constantZero, AssessorDesc::dInt);
         break;
@@ -384,7 +385,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayFloatType);
+                                         JavaRuntime::JavaArrayFloatType);
         push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dFloat);
         break;
       }
@@ -393,7 +394,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayDoubleType);
+                                         JavaRuntime::JavaArrayDoubleType);
         push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dDouble);
         push(mvm::jit::constantZero, AssessorDesc::dInt);
         break;
@@ -403,7 +404,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayObjectType);
+                                         JavaRuntime::JavaArrayObjectType);
         push(new LoadInst(ptr, "", currentBlock), AssessorDesc::dRef);
         break;
       }
@@ -412,7 +413,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArraySInt8Type);
+                                         JavaRuntime::JavaArraySInt8Type);
         Value* val = new LoadInst(ptr, "", currentBlock);
         push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
              AssessorDesc::dInt);
@@ -423,7 +424,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayUInt16Type);
+                                         JavaRuntime::JavaArrayUInt16Type);
         Value* val = new LoadInst(ptr, "", currentBlock);
         push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
              AssessorDesc::dInt);
@@ -434,7 +435,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArraySInt16Type);
+                                         JavaRuntime::JavaArraySInt16Type);
         Value* val = new LoadInst(ptr, "", currentBlock);
         push(new SExtInst(val, Type::Int32Ty, "", currentBlock),
              AssessorDesc::dInt);
@@ -579,7 +580,7 @@
         Value* index = popAsInt();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArraySInt32Type);
+                                         JavaRuntime::JavaArraySInt32Type);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -590,7 +591,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayLongType);
+                                         JavaRuntime::JavaArrayLongType);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -600,7 +601,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayFloatType);
+                                         JavaRuntime::JavaArrayFloatType);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -611,7 +612,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayDoubleType);
+                                         JavaRuntime::JavaArrayDoubleType);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -621,7 +622,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayObjectType);
+                                         JavaRuntime::JavaArrayObjectType);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -634,7 +635,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArraySInt8Type);
+                                         JavaRuntime::JavaArraySInt8Type);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -650,7 +651,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArrayUInt16Type);
+                                         JavaRuntime::JavaArrayUInt16Type);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -666,7 +667,7 @@
         Value* index = pop();
         Value* obj = pop();
         Value* ptr = verifyAndComputePtr(obj, index,
-                                         JnjvmModule::JavaArraySInt16Type);
+                                         JavaRuntime::JavaArraySInt16Type);
         new StoreInst(val, ptr, false, currentBlock);
         break;
       }
@@ -1646,7 +1647,7 @@
         Value* expr = ConstantExpr::getIntToPtr(
                                     ConstantInt::get(Type::Int64Ty,
                                                      uint64_t (jsrIndex++)),
-                                    JnjvmModule::JavaObjectType);
+                                    JavaRuntime::JavaObjectType);
 
         new StoreInst(expr, supplLocal, false, currentBlock);
         BranchInst::Create(opcodeInfos[tmp + readS2(bytecodes, i)].newBlock,
@@ -1829,7 +1830,7 @@
           uint8 id = bytecodes[++i];
           AssessorDesc* ass = AssessorDesc::arrayType(id);
           dcl = ass->arrayClass;
-          TheVT = JnjvmModule::JavaObjectVirtualTableGV;
+          TheVT = JavaRuntime::JavaObjectVirtualTableGV;
           LLVMAssessorInfo& LAI = LLVMAssessorInfo::AssessorInfo[ass->numId];
           sizeElement = LAI.sizeInBytesConstant;
         } else {
@@ -1841,11 +1842,11 @@
             AssessorDesc::constructArrayName(vm, 0, 1, className);
         
           dcl = vm->constructArray(arrayName, compilingClass->classLoader);
-          TheVT = JnjvmModule::ArrayObjectVirtualTableGV;
+          TheVT = JavaRuntime::ArrayObjectVirtualTableGV;
           sizeElement = mvm::jit::constantPtrSize;
         }
         
-        LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
+        LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
         llvm::Value* valCl = LCI->getVar(this);
         
         llvm::Value* arg1 = popAsInt();
@@ -1861,19 +1862,19 @@
         std::vector<Value*> exArgs;
         exArgs.push_back(arg1);
         if (currentExceptionBlock != endExceptionBlock) {
-          InvokeInst::Create(JnjvmModule::NegativeArraySizeExceptionFunction, 
+          InvokeInst::Create(JavaRuntime::NegativeArraySizeExceptionFunction, 
                              unifiedUnreachable,
                              currentExceptionBlock, exArgs.begin(),
                              exArgs.end(), "", currentBlock);
         } else {
-          CallInst::Create(JnjvmModule::NegativeArraySizeExceptionFunction,
+          CallInst::Create(JavaRuntime::NegativeArraySizeExceptionFunction,
                            exArgs.begin(), exArgs.end(), "", currentBlock);
           new UnreachableInst(currentBlock);
         }
         currentBlock = BB2;
         
         cmp = new ICmpInst(ICmpInst::ICMP_SGT, arg1,
-                           JnjvmModule::MaxArraySizeConstant,
+                           JavaRuntime::MaxArraySizeConstant,
                            "", currentBlock);
 
         BB1 = createBasicBlock("");
@@ -1882,12 +1883,12 @@
         BranchInst::Create(BB1, BB2, cmp, currentBlock);
         currentBlock = BB1;
         if (currentExceptionBlock != endExceptionBlock) {
-          InvokeInst::Create(JnjvmModule::OutOfMemoryErrorFunction,
+          InvokeInst::Create(JavaRuntime::OutOfMemoryErrorFunction,
                              unifiedUnreachable,
                              currentExceptionBlock, exArgs.begin(),
                              exArgs.end(), "", currentBlock);
         } else {
-          CallInst::Create(JnjvmModule::OutOfMemoryErrorFunction,
+          CallInst::Create(JavaRuntime::OutOfMemoryErrorFunction,
                            exArgs.begin(), exArgs.end(), "", currentBlock);
           new UnreachableInst(currentBlock);
         }
@@ -1896,24 +1897,24 @@
         Value* mult = BinaryOperator::createMul(arg1, sizeElement, "",
                                                 currentBlock);
         Value* size =
-          BinaryOperator::createAdd(JnjvmModule::JavaObjectSizeConstant, mult,
+          BinaryOperator::createAdd(JavaRuntime::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(JnjvmModule::GetCollectorFunction,
+        args.push_back(CallInst::Create(JavaRuntime::GetCollectorFunction,
                                         isolateLocal, "", currentBlock));
 #endif
-        Value* res = invoke(JnjvmModule::JavaObjectAllocateFunction, args, "",
+        Value* res = invoke(JavaRuntime::JavaObjectAllocateFunction, args, "",
                             currentBlock);
-        Value* cast = new BitCastInst(res, JnjvmModule::JavaArrayType, "",
+        Value* cast = new BitCastInst(res, JavaRuntime::JavaArrayType, "",
                                       currentBlock);
 
         // Set the size
         std::vector<Value*> gep4;
         gep4.push_back(mvm::jit::constantZero);
-        gep4.push_back(JnjvmModule::JavaArraySizeOffsetConstant);
+        gep4.push_back(JavaRuntime::JavaArraySizeOffsetConstant);
         Value* GEP = GetElementPtrInst::Create(cast, gep4.begin(), gep4.end(),
                                                "", currentBlock);
         new StoreInst(arg1, GEP, currentBlock);
@@ -1921,7 +1922,7 @@
         // Set the class
         std::vector<Value*> gep;
         gep.push_back(mvm::jit::constantZero);
-        gep.push_back(JnjvmModule::JavaObjectClassOffsetConstant);
+        gep.push_back(JavaRuntime::JavaObjectClassOffsetConstant);
         GEP = GetElementPtrInst::Create(res, gep.begin(), gep.end(), "",
                                         currentBlock);
         new StoreInst(valCl, GEP, currentBlock);
@@ -1943,12 +1944,12 @@
         std::vector<Value*> args;
         args.push_back(arg);
         if (currentExceptionBlock != endExceptionBlock) {
-          InvokeInst::Create(JnjvmModule::ThrowExceptionFunction,
+          InvokeInst::Create(JavaRuntime::ThrowExceptionFunction,
                              unifiedUnreachable,
                              currentExceptionBlock, args.begin(), args.end(),
                              "", currentBlock);
         } else {
-          CallInst::Create(JnjvmModule::ThrowExceptionFunction, args.begin(),
+          CallInst::Create(JavaRuntime::ThrowExceptionFunction, args.begin(),
                            args.end(), "", currentBlock);
           new UnreachableInst(currentBlock);
         }
@@ -1963,7 +1964,7 @@
         Value* obj = top();
 
         Value* cmp = new ICmpInst(ICmpInst::ICMP_EQ, obj,
-                                  JnjvmModule::JavaObjectNullConstant,
+                                  JavaRuntime::JavaObjectNullConstant,
                                   "", currentBlock);
         
         BasicBlock* ifTrue = createBasicBlock("null checkcast");
@@ -1973,7 +1974,7 @@
         currentBlock = ifFalse;
         Value* clVar = 0;
         if (dcl) {
-          LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
+          LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
           clVar = LCI->getVar(this);
         } else {
           clVar = getResolvedClass(index, false);
@@ -1981,7 +1982,7 @@
         std::vector<Value*> args;
         args.push_back(obj);
         args.push_back(clVar);
-        Value* call = CallInst::Create(JnjvmModule::InstanceOfFunction,
+        Value* call = CallInst::Create(JavaRuntime::InstanceOfFunction,
                                        args.begin(), args.end(),
                                        "", currentBlock);
         
@@ -1992,12 +1993,12 @@
         exArgs.push_back(obj);
         exArgs.push_back(clVar);
         if (currentExceptionBlock != endExceptionBlock) {
-          InvokeInst::Create(JnjvmModule::ClassCastExceptionFunction,
+          InvokeInst::Create(JavaRuntime::ClassCastExceptionFunction,
                              unifiedUnreachable,
                              currentExceptionBlock, exArgs.begin(),
                              exArgs.end(), "", ex);
         } else {
-          CallInst::Create(JnjvmModule::ClassCastExceptionFunction,
+          CallInst::Create(JavaRuntime::ClassCastExceptionFunction,
                            exArgs.begin(), exArgs.end(), "", ex);
           new UnreachableInst(ex);
         }
@@ -2013,7 +2014,7 @@
         
         Value* clVar = 0;
         if (dcl) {
-          LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
+          LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
           clVar = LCI->getVar(this);
         } else {
           clVar = getResolvedClass(index, false);
@@ -2021,7 +2022,7 @@
         std::vector<Value*> args;
         args.push_back(pop());
         args.push_back(clVar);
-        Value* val = CallInst::Create(JnjvmModule::InstanceOfFunction,
+        Value* val = CallInst::Create(JavaRuntime::InstanceOfFunction,
                                       args.begin(), args.end(), "",
                                       currentBlock);
         push(new ZExtInst(val, Type::Int32Ty, "", currentBlock),
@@ -2033,10 +2034,10 @@
         Value* obj = pop();
 #ifdef SERVICE_VM
         if (ServiceDomain::isLockableDomain(compilingClass->isolate))
-          invoke(JnjvmModule::AquireObjectInSharedDomainFunction, obj, "",
+          invoke(JavaRuntime::AquireObjectInSharedDomainFunction, obj, "",
                  currentBlock); 
         else
-          invoke(JnjvmModule::AquireObjectFunction, obj, "",
+          invoke(JavaRuntime::AquireObjectFunction, obj, "",
                  currentBlock); 
 #else
         JITVerifyNull(obj);
@@ -2049,10 +2050,10 @@
         Value* obj = pop();
 #ifdef SERVICE_VM
         if (ServiceDomain::isLockableDomain(compilingClass->isolate))
-          invoke(JnjvmModule::ReleaseObjectInSharedDomainFunction, obj, "",
+          invoke(JavaRuntime::ReleaseObjectInSharedDomainFunction, obj, "",
                  currentBlock); 
         else
-          invoke(JnjvmModule::ReleaseObjectFunction, obj, "",
+          invoke(JavaRuntime::ReleaseObjectFunction, obj, "",
                  currentBlock); 
 #else
         JITVerifyNull(obj);
@@ -2074,7 +2075,7 @@
         
         compilingClass->ctpInfo->loadClass(index);
         
-        LLVMCommonClassInfo* LCI = module->getClassInfo(dcl);
+        LLVMCommonClassInfo* LCI = JavaRuntime::getClassInfo(dcl);
         Value* valCl = LCI->getVar(this);
         Value** args = (Value**)alloca(sizeof(Value*) * (dim + 2));
         args[0] = valCl;
@@ -2090,7 +2091,7 @@
 #ifdef MULTIPLE_VM
         Args.push_back(isolateLocal);
 #endif
-        push(invoke(JnjvmModule::MultiCallNewFunction, Args, "", currentBlock),
+        push(invoke(JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaMetaJIT.cpp Wed Aug 13 08:13:05 2008
@@ -21,7 +21,6 @@
 #include "JavaThread.h"
 #include "JavaTypes.h"
 #include "Jnjvm.h"
-#include "JnjvmModule.h"
 
 using namespace jnjvm;
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp?rev=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaRuntimeJIT.cpp Wed Aug 13 08:13:05 2008
@@ -22,7 +22,6 @@
 #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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaTypes.cpp Wed Aug 13 08:13:05 2008
@@ -511,7 +511,7 @@
 
 intptr_t Signdef::staticCallBuf() {
   if (!_staticCallBuf) {
-    LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
+    LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
     LSI->getStaticBuf();
   }
   return _staticCallBuf;
@@ -519,7 +519,7 @@
 
 intptr_t Signdef::virtualCallBuf() {
   if (!_virtualCallBuf) {
-    LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
+    LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
     LSI->getVirtualBuf();
   }
   return _virtualCallBuf;
@@ -527,7 +527,7 @@
 
 intptr_t Signdef::staticCallAP() {
   if (!_staticCallAP) {
-    LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
+    LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(this);
     LSI->getStaticAP();
   }
   return _staticCallAP;
@@ -535,7 +535,7 @@
 
 intptr_t Signdef::virtualCallAP() {
   if (!_virtualCallAP) {
-    LLVMSignatureInfo* LSI = isolate->TheModule->getSignatureInfo(this);
+    LLVMSignatureInfo* LSI = JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaUpcalls.cpp Wed Aug 13 08:13:05 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); 
-  vm->TheModule->setMethod(internString, "internString");
+  JavaRuntime::setMethod(internString, "internString");
   
   JavaMethod* isArray =
     UPCALL_METHOD(vm, "java/lang/Class", "isArray", "()Z", ACC_VIRTUAL);
-  vm->TheModule->setMethod(isArray, "isArray");
+  JavaRuntime::setMethod(isArray, "isArray");
 
   ClasspathThread::initialise(vm);
     
@@ -400,17 +400,17 @@
   JavaMethod* getCallingClass =
     UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClass",
                   "()Ljava/lang/Class;", ACC_STATIC);
-  vm->TheModule->setMethod(getCallingClass, "getCallingClass");
+  JavaRuntime::setMethod(getCallingClass, "getCallingClass");
   
   JavaMethod* getCallingClassLoader =
     UPCALL_METHOD(vm, "gnu/classpath/VMStackWalker", "getCallingClassLoader",
                   "()Ljava/lang/ClassLoader;", ACC_STATIC);
-  vm->TheModule->setMethod(getCallingClassLoader, "getCallingClassLoader");
+  JavaRuntime::setMethod(getCallingClassLoader, "getCallingClassLoader");
   
   JavaMethod* postProperties =
     UPCALL_METHOD(vm, "gnu/classpath/VMSystemProperties", "postInit",
                   "(Ljava/util/Properties;)V", ACC_STATIC);
-  vm->TheModule->setMethod(postProperties, "propertiesPostInit");
+  JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.cpp Wed Aug 13 08:13:05 2008
@@ -331,7 +331,7 @@
         cl->super->initialiseClass();
       }
 
-      TheModule->resolveStaticClass((Class*)cl);
+      JavaRuntime::resolveStaticClass((Class*)cl);
       
       *status = inClinit;
       JavaMethod* meth = cl->lookupMethodDontThrow(clinitName, clinitType, true,
@@ -401,7 +401,7 @@
         loadParents((Class*)cl);
         cl->acquire(); 
         cl->status = prepared;
-        TheModule->resolveVirtualClass((Class*)cl);
+        JavaRuntime::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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/Jnjvm.h Wed Aug 13 08:13:05 2008
@@ -26,6 +26,10 @@
 #define vm_new(vm, cl) gc_new(cl)
 #endif
 
+namespace llvm {
+  class Module;
+}
+
 namespace jnjvm {
 
 class ArrayUInt8;
@@ -37,7 +41,6 @@
 class JavaMethod;
 class JavaObject;
 class JavaString;
-class JnjvmModule;
 class JnjvmModuleProvider;
 class Reader;
 class Typedef;
@@ -259,7 +262,7 @@
 
   
   JnjvmModuleProvider* TheModuleProvider;
-  JnjvmModule*         TheModule;
+  llvm::Module*         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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.cpp Wed Aug 13 08:13:05 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 = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
+  LLVMMethodInfo* LMI = JavaRuntime::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 = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
+    LLVMMethodInfo* LMI = JavaRuntime::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 = ((JnjvmModule*)TheModule)->getMethodInfo(meth);
+  LLVMMethodInfo* LMI = JavaRuntime::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 = (JnjvmModule*)TheModule;
+    jit.module = TheModule;
     jit.llvmFunction = func;
     if (isNative(meth->access)) {
       jit.nativeCompile();
@@ -156,8 +156,7 @@
 llvm::Function* JnjvmModuleProvider::addCallback(Class* cl, uint32 index,
                                                  Signdef* sign, bool stat) {
   const llvm::FunctionType* type = 0;
-  JnjvmModule* M = cl->isolate->TheModule;
-  LLVMSignatureInfo* LSI = M->getSignatureInfo(sign);
+  LLVMSignatureInfo* LSI = JavaRuntime::getSignatureInfo(sign);
   
   if (stat) {
     type = LSI->getStaticType();
@@ -225,7 +224,7 @@
   addPass(PM, createSCCPPass());                 // Constant prop with SCCP
   addPass(PM, createCFGSimplificationPass());    // Merge & remove BBs
   
-  addPass(PM, mvm::createEscapeAnalysisPass(JnjvmModule::JavaObjectAllocateFunction));
+  addPass(PM, mvm::createEscapeAnalysisPass(JavaRuntime::JavaObjectAllocateFunction));
   addPass(PM, mvm::createLowerConstantCallsPass());
   
   addPass(PM, createGVNPass());                  // Remove redundancies
@@ -241,7 +240,7 @@
   
 }
 
-JnjvmModuleProvider::JnjvmModuleProvider(JnjvmModule *m) {
+JnjvmModuleProvider::JnjvmModuleProvider(llvm::Module *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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModuleProvider.h Wed Aug 13 08:13:05 2008
@@ -15,13 +15,12 @@
 using namespace llvm;
 
 namespace llvm {
-class FunctionPassManager;
+  class FunctionPassManager;
+  class Module;
 }
 
 namespace jnjvm {
 
-class JnjvmModule;
-
 class JnjvmModuleProvider : public ModuleProvider {
 private:
   JavaMethod* staticLookup(Class* caller, uint32 index);
@@ -42,7 +41,7 @@
 
 public:
   
-  JnjvmModuleProvider(JnjvmModule *m);
+  JnjvmModuleProvider(llvm::Module *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=54732&r1=54731&r2=54732&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp Wed Aug 13 08:13:05 2008
@@ -16,7 +16,7 @@
 
 #include "mvm/JIT.h"
 
-#include "JnjvmModule.h"
+#include "JavaRuntime.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::JnjvmModule::ArrayLengthFunction) {
+        if (V == jnjvm::JavaRuntime::ArrayLengthFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); // get the array
-          Value* array = new BitCastInst(val, jnjvm::JnjvmModule::JavaArrayType,
+          Value* array = new BitCastInst(val, jnjvm::JavaRuntime::JavaArrayType,
                                          "", CI);
           std::vector<Value*> args; //size=  2
           args.push_back(mvm::jit::constantZero);
-          args.push_back(jnjvm::JnjvmModule::JavaArraySizeOffsetConstant);
+          args.push_back(jnjvm::JavaRuntime::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::JnjvmModule::GetVTFunction) {
+        } else if (V == jnjvm::JavaRuntime::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::JnjvmModule::GetClassFunction) {
+        } else if (V == jnjvm::JavaRuntime::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::JnjvmModule::JavaObjectClassOffsetConstant);
+          args2.push_back(jnjvm::JavaRuntime::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::JnjvmModule::GetVTFromClassFunction) {
+        } else if (V == jnjvm::JavaRuntime::GetVTFromClassFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); 
           std::vector<Value*> indexes; 
           indexes.push_back(mvm::jit::constantZero);
-          indexes.push_back(jnjvm::JnjvmModule::OffsetVTInClassConstant);
+          indexes.push_back(jnjvm::JavaRuntime::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::JnjvmModule::GetObjectSizeFromClassFunction) {
+        } else if (V == jnjvm::JavaRuntime::GetObjectSizeFromClassFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); 
           std::vector<Value*> indexes; 
           indexes.push_back(mvm::jit::constantZero);
-          indexes.push_back(JnjvmModule::OffsetObjectSizeInClassConstant);
+          indexes.push_back(JavaRuntime::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::JnjvmModule::ForceInitialisationCheckFunction) {
+        } else if (V == jnjvm::JavaRuntime::ForceInitialisationCheckFunction) {
           Changed = true;
           CI->eraseFromParent();
-        } else if (V == jnjvm::JnjvmModule::GetDepthFunction) {
+        } else if (V == jnjvm::JavaRuntime::GetDepthFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); 
           std::vector<Value*> indexes; 
           indexes.push_back(mvm::jit::constantZero);
-          indexes.push_back(JnjvmModule::OffsetDepthInClassConstant);
+          indexes.push_back(JavaRuntime::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::JnjvmModule::GetDisplayFunction) {
+        } else if (V == jnjvm::JavaRuntime::GetDisplayFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); 
           std::vector<Value*> indexes; 
           indexes.push_back(mvm::jit::constantZero);
-          indexes.push_back(JnjvmModule::OffsetDisplayInClassConstant);
+          indexes.push_back(JavaRuntime::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::JnjvmModule::GetClassInDisplayFunction) {
+        } else if (V == jnjvm::JavaRuntime::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::JnjvmModule::InstanceOfFunction) {
+        } else if (V == jnjvm::JavaRuntime::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,
-                                            JnjvmModule::JavaObjectNullConstant,
+                                            JavaRuntime::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(JnjvmModule::GetClassFunction, obj,
+            Value* objCl = CallInst::Create(JavaRuntime::GetClassFunction, obj,
                                             "", ifFalse);
             
             if (isInterface(cl->access)) {
               std::vector<Value*> args;
               args.push_back(objCl);
               args.push_back(CE);
-              Value* res = CallInst::Create(JnjvmModule::ImplementsFunction,
+              Value* res = CallInst::Create(JavaRuntime::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(JnjvmModule::IsAssignableFromFunction,
+                cmp = CallInst::Create(JavaRuntime::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(JnjvmModule::InstantiationOfArrayFunction,
+                  CallInst::Create(JavaRuntime::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(JnjvmModule::GetDepthFunction,
+                  depthCl = CallInst::Create(JavaRuntime::GetDepthFunction,
                                              CE, "", notEquals);
                 }
-                Value* depthClObj = CallInst::Create(JnjvmModule::GetDepthFunction,
+                Value* depthClObj = CallInst::Create(JavaRuntime::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(JnjvmModule::GetDisplayFunction, objCl,
+                  CallInst::Create(JavaRuntime::GetDisplayFunction, objCl,
                                    "", supDepth);
             
                 std::vector<Value*> args;
                 args.push_back(inDisplay);
                 args.push_back(depthCl);
                 Value* clInDisplay = 
-                  CallInst::Create(JnjvmModule::GetClassInDisplayFunction,
+                  CallInst::Create(JavaRuntime::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::JnjvmModule::GetCollectorFunction) {
+        else if (V == jnjvm::JavaRuntime::GetCollectorFunction) {
           Changed = true;
           Value* val = CI->getOperand(1); 
           std::vector<Value*> indexes; 





More information about the vmkit-commits mailing list