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

Nicolas Geoffray nicolas.geoffray at lip6.fr
Sun Oct 26 16:49:13 PDT 2008


Author: geoffray
Date: Sun Oct 26 18:49:13 2008
New Revision: 58219

URL: http://llvm.org/viewvc/llvm-project?rev=58219&view=rev
Log:
Only getstatic/putstatic have different behaviors when static
compiling.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.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=58219&r1=58218&r2=58219&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaJIT.cpp Sun Oct 26 18:49:13 2008
@@ -1836,8 +1836,22 @@
     LLVMFieldInfo* LFI = module->getFieldInfo(field);
     const Type* type = 0;
     if (stat) {
-
+      
 #ifndef ISOLATE_SHARING
+      if (module->isStaticCompiling()) {
+        // Do an initialization check first.
+        Value* Cl = module->getNativeClass(field->classDef);
+        Cl = new LoadInst(Cl, "", currentBlock);
+        Cl = invoke(module->InitialisationCheckFunction, Cl, "",
+                    currentBlock);
+        CallInst::Create(module->ForceInitialisationCheckFunction, Cl, "",
+                         currentBlock);
+        object = module->getStaticInstance(field->classDef);
+        object = new LoadInst(object, "", currentBlock);
+        type = LCI->getStaticType();
+        return fieldGetter(this, type, object, LFI->getOffset());
+      }
+      
       if (field->classDef->isReady()) {
         object = module->getStaticInstance(field->classDef);
         object = new LoadInst(object, "", currentBlock);
@@ -1854,29 +1868,29 @@
     }
   }
 
-    const Type* Pty = module->arrayPtrType;
-    Constant* zero = module->constantZero;
+  const Type* Pty = module->arrayPtrType;
+  Constant* zero = module->constantZero;
     
-    Function* func = stat ? module->StaticFieldLookupFunction :
-                            module->VirtualFieldLookupFunction;
+  Function* func = stat ? module->StaticFieldLookupFunction :
+                          module->VirtualFieldLookupFunction;
     
-    const Type* returnType = 0;
-    if (stat)
-      returnType = module->ptrType;
-    else
-      returnType = Type::Int32Ty;
-
-    Value* ptr = getConstantPoolAt(index, func, returnType, 0, true);
-    if (!stat) {
-      Value* tmp = new BitCastInst(object, Pty, "", currentBlock);
-      std::vector<Value*> args;
-      args.push_back(zero);
-      args.push_back(ptr);
-      ptr = GetElementPtrInst::Create(tmp, args.begin(), args.end(), "",
-                                      currentBlock);
-    }
+  const Type* returnType = 0;
+  if (stat)
+    returnType = module->ptrType;
+  else
+    returnType = Type::Int32Ty;
+
+  Value* ptr = getConstantPoolAt(index, func, returnType, 0, true);
+  if (!stat) {
+    Value* tmp = new BitCastInst(object, Pty, "", currentBlock);
+    std::vector<Value*> args;
+    args.push_back(zero);
+    args.push_back(ptr);
+    ptr = GetElementPtrInst::Create(tmp, args.begin(), args.end(), "",
+                                    currentBlock);
+  }
     
-    return new BitCastInst(ptr, fieldTypePtr, "", currentBlock);
+  return new BitCastInst(ptr, fieldTypePtr, "", currentBlock);
 }
 
 void JavaJIT::convertValue(Value*& val, const Type* t1, BasicBlock* currentBlock,

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.h Sun Oct 26 18:49:13 2008
@@ -217,7 +217,11 @@
 
   
 public:
-  
+
+  bool isStaticCompiling() {
+    return staticCompilation;
+  }
+
   static llvm::ConstantInt* JavaArraySizeOffsetConstant;
   static llvm::ConstantInt* JavaArrayElementsOffsetConstant;
   static llvm::ConstantInt* JavaObjectLockOffsetConstant;





More information about the vmkit-commits mailing list