[vmkit-commits] [vmkit] r89090 - in /vmkit/trunk/lib/JnJVM/Compiler: JavaJIT.cpp JavaJIT.h JavaJITOpcodes.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Nov 17 02:41:00 PST 2009


Author: geoffray
Date: Tue Nov 17 04:41:00 2009
New Revision: 89090

URL: http://llvm.org/viewvc/llvm-project?rev=89090&view=rev
Log:
Continue adding some Metadata info to values.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.cpp Tue Nov 17 04:41:00 2009
@@ -819,6 +819,7 @@
     for (int i = 0; i < maxStack; i++) {
       objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
                                            firstInstruction));
+      addHighLevelType(objectStack.back(), upcalls->OfObject);
       intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstInstruction));
       doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "",
                                            firstInstruction));
@@ -846,6 +847,7 @@
     for (int i = 0; i < maxStack; i++) {
       objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
                                            firstBB));
+      addHighLevelType(objectStack.back(), upcalls->OfObject);
       intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", firstBB));
       doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", firstBB));
       longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", firstBB));
@@ -1008,6 +1010,7 @@
   for (int i = 0; i < maxStack; i++) {
     objectStack.push_back(new AllocaInst(module->JavaObjectType, "",
                                          currentBlock));
+    addHighLevelType(objectStack.back(), upcalls->OfObject);
     intStack.push_back(new AllocaInst(Type::getInt32Ty(getGlobalContext()), "", currentBlock));
     doubleStack.push_back(new AllocaInst(Type::getDoubleTy(getGlobalContext()), "", currentBlock));
     longStack.push_back(new AllocaInst(Type::getInt64Ty(getGlobalContext()), "", currentBlock));
@@ -1875,14 +1878,16 @@
   }
  
   VT = new BitCastInst(VT, module->ptrType, "", currentBlock);
-  Value* val = invoke(cl ? module->AllocateFunction :
+  Instruction* val = invoke(cl ? module->AllocateFunction :
                            module->AllocateUnresolvedFunction,
-                      Size, VT, "", currentBlock);
+                           Size, VT, "", currentBlock);
 
   if (cl && cl->virtualVT->destructor) {
     CallInst::Create(module->AddFinalizationCandidate, val, "", currentBlock);
   }
 
+
+  addHighLevelType(val, cl ? cl : upcalls->OfObject);
   val = new BitCastInst(val, module->JavaObjectType, "", currentBlock);
   push(val, false, cl ? cl : upcalls->OfObject);
 }

Modified: vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h?rev=89090&r1=89089&r2=89090&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h Tue Nov 17 04:41:00 2009
@@ -243,6 +243,9 @@
                         currentBlock);
       stack.push_back(cl ? cl : upcalls->OfObject);
       addHighLevelType(V, topTypeInfo());
+      if (llvm::Instruction* I = llvm::dyn_cast<llvm::Instruction>(val)) {
+        addHighLevelType(I, topTypeInfo());
+      }
     }
   }
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Tue Nov 17 04:41:00 2009
@@ -508,11 +508,14 @@
                       false, currentBlock);
         break;
 
-      case ASTORE :
-        new StoreInst(pop(), objectLocals[WREAD_U1(bytecodes, false, i, wide)],
-                      false, currentBlock);
+      case ASTORE : {
+        CommonClass* cl = topTypeInfo();
+        Instruction* V =
+          new StoreInst(pop(), objectLocals[WREAD_U1(bytecodes, false, i, wide)],
+                        false, currentBlock);
+        addHighLevelType(V, cl);
         break;
-      
+      } 
       case ISTORE_0 : {
         Value* val = pop();
         if (val->getType() != Type::getInt32Ty(*llvmContext)) // int8 and int16
@@ -601,22 +604,38 @@
         new StoreInst(pop(), doubleLocals[3], false, currentBlock);
         break;
       
-      case ASTORE_0 :
-        new StoreInst(pop(), objectLocals[0], false, currentBlock);
+      case ASTORE_0 : {
+        CommonClass* cl = topTypeInfo();
+        Instruction* V = new StoreInst(pop(), objectLocals[0], false,
+                                       currentBlock);
+        addHighLevelType(V, cl);
         break;
+      }
       
-      case ASTORE_1 :
-        new StoreInst(pop(), objectLocals[1], false, currentBlock);
+      case ASTORE_1 : {
+        CommonClass* cl = topTypeInfo();
+        Instruction* V = new StoreInst(pop(), objectLocals[1], false,
+                                       currentBlock);
+        addHighLevelType(V, cl);
         break;
+      }
       
-      case ASTORE_2 :
-        new StoreInst(pop(), objectLocals[2], false, currentBlock);
+      case ASTORE_2 : {
+        CommonClass* cl = topTypeInfo();
+        Instruction* V = new StoreInst(pop(), objectLocals[2], false,
+                                       currentBlock);
+        addHighLevelType(V, cl);
         break;
+      }
       
-      case ASTORE_3 :
-        new StoreInst(pop(), objectLocals[3], false, currentBlock);
+      case ASTORE_3 : {
+        CommonClass* cl = topTypeInfo();
+        Instruction* V = new StoreInst(pop(), objectLocals[3], false,
+                                       currentBlock);
+        addHighLevelType(V, cl);
         break;
-
+      }
+      
       case IASTORE : {
         Value* val = popAsInt();
         Value* index = popAsInt();
@@ -2035,8 +2054,8 @@
           BinaryOperator::CreateAdd(module->JavaArraySizeConstant, mult,
                                     "", currentBlock);
         TheVT = new BitCastInst(TheVT, module->ptrType, "", currentBlock);
-        Value* res = invoke(module->AllocateFunction, size, TheVT, "",
-                            currentBlock);
+        Instruction* res = invoke(module->AllocateFunction, size, TheVT, "",
+                                  currentBlock);
         Value* cast = new BitCastInst(res, module->JavaArrayType, "",
                                       currentBlock);
 
@@ -2049,6 +2068,7 @@
         arg1 = new IntToPtrInst(arg1, module->ptrType, "", currentBlock);
         new StoreInst(arg1, GEP, currentBlock);
        
+        addHighLevelType(res, dcl ? dcl : upcalls->ArrayOfObject);
         res = new BitCastInst(res, module->JavaObjectType, "", currentBlock);
         push(res, false, dcl ? dcl : upcalls->ArrayOfObject);
 





More information about the vmkit-commits mailing list