[vmkit-commits] [vmkit] r58211 - in /vmkit/trunk/lib/JnJVM/VMCore: JavaJIT.cpp JavaJITOpcodes.cpp JnjvmModule.cpp JnjvmModule.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Oct 26 15:52:22 PDT 2008


Author: geoffray
Date: Sun Oct 26 17:52:21 2008
New Revision: 58211

URL: http://llvm.org/viewvc/llvm-project?rev=58211&view=rev
Log:
Code cleanup. No functionality changes.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Sun Oct 26 17:52:21 2008
@@ -84,7 +84,8 @@
   if (meth && !isAbstract(meth->access) && canBeInlined(meth)) {
     Value* cl = CallInst::Create(module->GetClassFunction, args[0], "",
                                   currentBlock);
-    Value* cl2 = module->getNativeClass((Class*)cl, this);
+    Value* cl2 = module->getNativeClass((Class*)cl);
+    cl2 = new LoadInst(cl2, "", currentBlock);
 
     Value* test = new ICmpInst(ICmpInst::ICMP_EQ, cl, cl2, "", currentBlock);
 
@@ -267,7 +268,9 @@
                                   val, "", currentBlock);
     nativeArgs.push_back(res);
 #else
-    nativeArgs.push_back(module->getJavaClass(compilingClass, this));
+    Value* cl = module->getJavaClass(compilingClass);
+    cl= new LoadInst(cl, "", currentBlock);
+    nativeArgs.push_back(cl);
 #endif
     index = 2;
   } else {
@@ -482,7 +485,8 @@
     obj = llvmFunction->arg_begin();
   } else {
 #ifndef ISOLATE_SHARING
-    obj = module->getStaticInstance(compilingClass, this);
+    obj = module->getStaticInstance(compilingClass);
+    obj = new LoadInst(obj, "", currentBlock);
 #else
     obj = getStaticInstanceCtp();
 #endif
@@ -506,7 +510,8 @@
     obj = llvmFunction->arg_begin();
   } else {
 #ifndef ISOLATE_SHARING
-    obj = module->getStaticInstance(compilingClass, this);
+    obj = module->getStaticInstance(compilingClass);
+    obj = new LoadInst(obj, "", currentBlock);
 #else
     obj = getStaticInstanceCtp();
 #endif
@@ -953,7 +958,8 @@
       argsSync.push_back(llvmFunction->arg_begin());
     } else {
 #ifndef ISOLATE_SHARING
-      Value* arg = module->getStaticInstance(compilingClass, this);
+      Value* arg = module->getStaticInstance(compilingClass);
+      arg = new LoadInst(arg, "", currentBlock);
 #else
       Value* arg = getStaticInstanceCtp();
 #endif
@@ -1121,7 +1127,8 @@
                                isolateLocal, "", currentBlock);
 #else
     assert(cur->catchClass);
-    cl = module->getNativeClass(cur->catchClass, this);
+    cl = module->getNativeClass(cur->catchClass);
+    cl = new LoadInst(cl, "", currentBlock);
 #endif
     Value* cmp = llvm::CallInst::Create(module->CompareExceptionFunction, cl, "",
                                         currentBlock);
@@ -1194,7 +1201,8 @@
     const UTF8* utf8 = ctpInfo->UTF8At(ctpInfo->ctpDef[index]);
     JavaString* str = compilingClass->classLoader->UTF8ToStr(utf8);
 
-    Value* val = module->getString(str, this);
+    Value* val = module->getString(str);
+    val = new LoadInst(val, "", currentBlock);
     push(val, false);
 #endif
         
@@ -1214,7 +1222,9 @@
 #if !defined(ISOLATE)
     if (ctpInfo->ctpRes[index]) {
       CommonClass* cl = (CommonClass*)(ctpInfo->ctpRes[index]);
-      push(module->getJavaClass(cl, this), false);
+      Value* Val = module->getJavaClass(cl);
+      Val = new LoadInst(Val, "", currentBlock);
+      push(Val, false);
     } else {
 #endif
       Value* val = getResolvedClass(index, false);
@@ -1693,8 +1703,10 @@
   Args.clear();
 #else
   JavaConstantPool* ctp = compilingClass->ctpInfo;
-  Value* CTP = module->getConstantPool(ctp, this);
-  Value* Cl = module->getNativeClass(compilingClass, this);
+  Value* CTP = module->getConstantPool(ctp);
+  CTP = new LoadInst(CTP, "", currentBlock);
+  Value* Cl = module->getNativeClass(compilingClass);
+  Cl = new LoadInst(Cl, "", currentBlock);
 #endif
 
   Args.push_back(resolver);
@@ -1750,10 +1762,12 @@
                           currentBlock);
   } else {
     LLVMClassInfo* LCI = module->getClassInfo(cl);
-    Size = LCI->getVirtualSize(this);
+    Size = LCI->getVirtualSize();
 #ifndef ISOLATE_SHARING
-    VT = module->getVirtualTable(cl, this);
-    Cl = module->getNativeClass(cl, this);
+    VT = module->getVirtualTable(cl);
+    VT = new LoadInst(VT, "", currentBlock);
+    Cl = module->getNativeClass(cl);
+    Cl = new LoadInst(Cl, "", currentBlock);
     if (!cl->isReady()) {
       Cl = invoke(module->InitialisationCheckFunction, Cl, "",
                   currentBlock);
@@ -1825,7 +1839,8 @@
 
 #ifndef ISOLATE_SHARING
       if (field->classDef->isReady()) {
-        object = module->getStaticInstance(field->classDef, this);
+        object = module->getStaticInstance(field->classDef);
+        object = new LoadInst(object, "", currentBlock);
         type = LCI->getStaticType();
         return fieldGetter(this, type, object, LFI->getOffset());
       }
@@ -2063,7 +2078,8 @@
   if (!inlining)
     enveloppe.initialise(compilingClass->ctpInfo, index);
    
-  Value* llvmEnv = module->getEnveloppe(&enveloppe, this);
+  Value* llvmEnv = module->getEnveloppe(&enveloppe);
+  llvmEnv = new LoadInst(llvmEnv, "", currentBlock);
 #else
   Value* llvmEnv = getConstantPoolAt(index,
                                      module->EnveloppeLookupFunction,

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJITOpcodes.cpp Sun Oct 26 17:52:21 2008
@@ -1872,8 +1872,10 @@
           sizeElement = module->constantPtrSize;
         }
 #ifndef ISOLATE_SHARING
-        valCl = module->getNativeClass(dcl, this);
-        TheVT = module->getVirtualTable(dcl, this);
+        valCl = module->getNativeClass(dcl);
+        valCl = new LoadInst(valCl, "", currentBlock);
+        TheVT = module->getVirtualTable(dcl);
+        TheVT = new LoadInst(TheVT, "", currentBlock);
 #endif   
         llvm::Value* arg1 = popAsInt();
 
@@ -2003,7 +2005,8 @@
         Value* clVar = 0;
 #ifndef ISOLATE_SHARING
         if (dcl) {
-          clVar = module->getNativeClass(dcl, this);
+          clVar = module->getNativeClass(dcl);
+          clVar = new LoadInst(clVar, "", currentBlock);
         } else
 #endif
           clVar = getResolvedClass(index, false);
@@ -2044,7 +2047,8 @@
         
         Value* clVar = 0;
         if (dcl) {
-          clVar = module->getNativeClass(dcl, this);
+          clVar = module->getNativeClass(dcl);
+          clVar = new LoadInst(clVar, "", currentBlock);
         } else {
           clVar = getResolvedClass(index, false);
         }
@@ -2109,7 +2113,8 @@
         UserClassArray* dcl = JCL->constructArray(className);
         
         compilingClass->ctpInfo->loadClass(index);
-        Value* valCl = module->getNativeClass(dcl ,this);
+        Value* valCl = module->getNativeClass(dcl);
+        valCl = new LoadInst(valCl, "", currentBlock);
 #endif
         Value** args = (Value**)alloca(sizeof(Value*) * (dim + 2));
         args[0] = valCl;

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Sun Oct 26 17:52:21 2008
@@ -8,18 +8,17 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CallingConv.h"
+#include "llvm/Instructions.h"
 #include "llvm/Support/MutexGuard.h"
 
 
 #include "mvm/JIT.h"
 
-#include "JavaJIT.h"
 #include "JavaThread.h"
 #include "JavaTypes.h"
 #include "Jnjvm.h"
 #include "JnjvmModule.h"
 #include "JnjvmModuleProvider.h"
-#include "LockedMap.h"
 
 
 using namespace jnjvm;
@@ -66,7 +65,7 @@
 llvm::ConstantInt*    JnjvmModule::JavaObjectLockOffsetConstant;
 llvm::ConstantInt*    JnjvmModule::JavaObjectClassOffsetConstant;
 
-Value* JnjvmModule::getNativeClass(CommonClass* classDef, JavaJIT* jit) {
+Value* JnjvmModule::getNativeClass(CommonClass* classDef) {
   llvm::GlobalVariable* varGV = 0;
   native_class_iterator End = nativeClasses.end();
   native_class_iterator I = nativeClasses.find(classDef);
@@ -84,10 +83,10 @@
   } else {
     varGV = I->second;
   }   
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getConstantPool(JavaConstantPool* ctp, JavaJIT* jit) {
+Value* JnjvmModule::getConstantPool(JavaConstantPool* ctp) {
   llvm::GlobalVariable* varGV = 0;
   constant_pool_iterator End = constantPools.end();
   constant_pool_iterator I = constantPools.find(ctp);
@@ -103,10 +102,10 @@
   } else {
     varGV = I->second;
   }
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getString(JavaString* str, JavaJIT* jit) {
+Value* JnjvmModule::getString(JavaString* str) {
   llvm::GlobalVariable* varGV;
   string_iterator SI = strings.find(str);
   if (SI != strings.end()) {
@@ -121,10 +120,10 @@
                                cons, "", this);
     strings.insert(std::make_pair(str, varGV));
   }
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getEnveloppe(Enveloppe* enveloppe, JavaJIT* jit) {
+Value* JnjvmModule::getEnveloppe(Enveloppe* enveloppe) {
   llvm::GlobalVariable* varGV;
   enveloppe_iterator SI = enveloppes.find(enveloppe);
   if (SI != enveloppes.end()) {
@@ -139,10 +138,10 @@
                                cons, "", this);
     enveloppes.insert(std::make_pair(enveloppe, varGV));
   }
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getJavaClass(CommonClass* cl, JavaJIT* jit) {
+Value* JnjvmModule::getJavaClass(CommonClass* cl) {
   llvm::GlobalVariable* varGV = 0;
   java_class_iterator End = javaClasses.end();
   java_class_iterator I = javaClasses.find(cl);
@@ -160,10 +159,10 @@
   } else {
     varGV = I->second;
   }
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getStaticInstance(Class* classDef, JavaJIT* jit) {
+Value* JnjvmModule::getStaticInstance(Class* classDef) {
   llvm::GlobalVariable* varGV = 0;
   static_instance_iterator End = staticInstances.end();
   static_instance_iterator I = staticInstances.find(classDef);
@@ -184,10 +183,10 @@
     varGV = I->second;
   }
 
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
-Value* JnjvmModule::getVirtualTable(CommonClass* classDef, JavaJIT* jit) {
+Value* JnjvmModule::getVirtualTable(CommonClass* classDef) {
   llvm::GlobalVariable* varGV = 0;
   virtual_table_iterator End = virtualTables.end();
   virtual_table_iterator I = virtualTables.find(classDef);
@@ -208,7 +207,7 @@
   } else {
     varGV = I->second;
   }
-  return new LoadInst(varGV, "", jit->currentBlock);
+  return varGV;
 }
 
 #ifndef WITHOUT_VTABLE
@@ -218,7 +217,6 @@
     uint64 size = cl->virtualTableSize;
     mvm::BumpPtrAllocator& allocator = cl->classLoader->allocator;
     VirtualTable* VT = (VirtualTable*)allocator.Allocate(size * sizeof(void*));
-    if (!VT) JavaThread::get()->isolate->outOfMemoryError(size * sizeof(void*));
     if (cl->super) {
       Class* super = (Class*)cl->super;
       assert(cl->virtualTableSize >= cl->super->virtualTableSize &&
@@ -485,7 +483,7 @@
 }
 
 
-Value* LLVMClassInfo::getVirtualSize(JavaJIT* jit) {
+Value* LLVMClassInfo::getVirtualSize() {
   if (!virtualSizeConstant) {
     getVirtualType();
     virtualSizeConstant = 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h?rev=58211&r1=58210&r2=58211&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h Sun Oct 26 17:52:21 2008
@@ -33,7 +33,6 @@
 class JavaField;
 class JavaMethod;
 class JavaObject;
-class JavaJIT;
 class JnjvmModule;
 class Signdef;
 
@@ -68,7 +67,7 @@
   const llvm::Type * staticType;
 public:
   
-  llvm::Value* getVirtualSize(JavaJIT* jit);
+  llvm::Value* getVirtualSize();
   llvm::Function* getStaticTracer();
   llvm::Function* getVirtualTracer();
   const llvm::Type* getVirtualType();
@@ -365,14 +364,14 @@
   explicit JnjvmModule(const std::string &ModuleID);
   static void initialise();
 
-  llvm::Value* getNativeClass(CommonClass* cl, JavaJIT* jit);
-  llvm::Value* getJavaClass(CommonClass* cl, JavaJIT* jit);
-  llvm::Value* getStaticInstance(Class* cl, JavaJIT* jit);
-  llvm::Value* getVirtualTable(CommonClass* cl, JavaJIT* jit);
-  
-  llvm::Value* getEnveloppe(Enveloppe* enveloppe, JavaJIT* jit);
-  llvm::Value* getString(JavaString* str, JavaJIT* jit);
-  llvm::Value* getConstantPool(JavaConstantPool* ctp, JavaJIT* jit);
+  llvm::Value* getNativeClass(CommonClass* cl);
+  llvm::Value* getJavaClass(CommonClass* cl);
+  llvm::Value* getStaticInstance(Class* cl);
+  llvm::Value* getVirtualTable(CommonClass* cl);
+  
+  llvm::Value* getEnveloppe(Enveloppe* enveloppe);
+  llvm::Value* getString(JavaString* str);
+  llvm::Value* getConstantPool(JavaConstantPool* ctp);
 
 private:
   static llvm::Module* initialModule;





More information about the vmkit-commits mailing list