[vmkit-commits] [vmkit] r69037 - in /vmkit/trunk/lib/JnJVM: Compiler/JavaAOTCompiler.cpp Compiler/JavaJIT.h Compiler/JavaJITOpcodes.cpp Compiler/JnjvmModule.cpp VMCore/JavaClass.cpp VMCore/JavaClass.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Tue Apr 14 02:18:12 PDT 2009


Author: geoffray
Date: Tue Apr 14 04:17:54 2009
New Revision: 69037

URL: http://llvm.org/viewvc/llvm-project?rev=69037&view=rev
Log:
The display of VT is made of VTs, not classes.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaAOTCompiler.cpp Tue Apr 14 04:17:54 2009
@@ -1201,24 +1201,17 @@
         ConstantInt::get(Type::Int64Ty, VT->depth), PTy));
   
   // display
-  const ArrayType* DTy = ArrayType::get(JnjvmModule::JavaCommonClassType,
+  const ArrayType* DTy = ArrayType::get(JnjvmModule::VTType,
                                         VT->depth + 1);
   
   std::vector<Constant*> TempElmts;
-  Constant* ClGEPs[2] = { JnjvmModule::constantZero,
-                          JnjvmModule::constantZero };
-
-  
   for (uint32 i = 0; i <= VT->depth; ++i) {
-    Constant* Cl = getNativeClass(VT->display[i]);
-    if (Cl->getType() != JnjvmModule::JavaCommonClassType)
-      Cl = ConstantExpr::getGetElementPtr(Cl, ClGEPs, 2);
-    
+    Constant* Cl = getVirtualTable(VT->display[i]);
     TempElmts.push_back(Cl);
   }
-
   Constant* display = ConstantArray::get(DTy, TempElmts);
   TempElmts.clear();
+  
   display = new GlobalVariable(DTy, true, GlobalValue::InternalLinkage,
                                display, "", getLLVMModule());
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJIT.h Tue Apr 14 04:17:54 2009
@@ -114,13 +114,6 @@
   void convertValue(llvm::Value*& val, const llvm::Type* t1,
                     llvm::BasicBlock* currentBlock, bool usign);
  
-  /// getConstantPoolAt - Return the value at the given index of the constant
-  /// pool. The generated code invokes the resolver if the constant pool
-  /// contains no value at the index.
-  llvm::Value* getConstantPoolAt(uint32 index, llvm::Function* resolver,
-                                 const llvm::Type* returnType,
-                                 llvm::Value* addArg, bool doThrow = true);
-
   /// getCurrentThread - Emit code to get the current thread.
   llvm::Value* getCurrentThread();
 
@@ -350,7 +343,15 @@
   /// of the returned value is Class.
   llvm::Value* getResolvedClass(uint16 index, bool clinit, bool doThrow,
                                 UserClass** alreadyResolved);
+  
+  /// getConstantPoolAt - Return the value at the given index of the constant
+  /// pool. The generated code invokes the resolver if the constant pool
+  /// contains no value at the index.
+  llvm::Value* getConstantPoolAt(uint32 index, llvm::Function* resolver,
+                                 const llvm::Type* returnType,
+                                 llvm::Value* addArg, bool doThrow = true);
 
+  llvm::Value* getResolvedVirtualTable(uint16 index, bool doThrow, bool clinit);
 
 //===----------------------- Java method calls  ---------------------------===//
   

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JavaJITOpcodes.cpp Tue Apr 14 04:17:54 2009
@@ -2009,7 +2009,7 @@
           node->addIncoming(ConstantInt::getFalse(), currentBlock);
           Value* objCl = CallInst::Create(module->GetClassFunction, obj, "",
                                           ifFalse);
-          Value* classArgs[2] = { objCl, clVar };            
+          Value* classArgs[2] = { objCl, clVar }; 
             
           if (isInterface(cl->access)) {
             Value* res = CallInst::Create(module->ImplementsFunction,

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/Compiler/JnjvmModule.cpp Tue Apr 14 04:17:54 2009
@@ -130,9 +130,9 @@
   } else {
     VT = &JavaObjectVT;
     VT->depth = 0;
-    VT->display = (CommonClass**)
-      cl->classLoader->allocator.Allocate(sizeof(CommonClass*));
-    VT->display[0] = cl;
+    VT->display = (JavaVirtualTable**)
+      cl->classLoader->allocator.Allocate(sizeof(JavaVirtualTable*));
+    VT->display[0] = VT;
 
   }
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Tue Apr 14 04:17:54 2009
@@ -1290,7 +1290,9 @@
   // Set the values in the JavaObject VT
   cl->virtualVT->depth = 0;
   cl->virtualVT->cl = cl;
-  cl->virtualVT->display = cl->display;
+  cl->virtualVT->display = (JavaVirtualTable**)
+    cl->classLoader->allocator.Allocate(sizeof(JavaVirtualTable*));
+  cl->virtualVT->display[0] = cl->virtualVT;
 
   Classpath* upcalls = cl->classLoader->bootstrapLoader->upcalls;
 
@@ -1329,11 +1331,11 @@
   // (3) Set depth and display for fast dynamic type checking.
   depth = cl->super->virtualVT->depth + 1;
   mvm::BumpPtrAllocator& allocator = cl->classLoader->allocator;
-  display = (CommonClass**)
-    allocator.Allocate(sizeof(CommonClass*) * (depth + 1));   
-  size = depth * sizeof(UserCommonClass*);
+  display = (JavaVirtualTable**)
+    allocator.Allocate(sizeof(JavaVirtualTable*) * (depth + 1));   
+  size = depth * sizeof(JavaVirtualTable*);
   memcpy(display, cl->super->virtualVT->display, size); 
-  display[depth] = C;
+  display[depth] = this;
 }
   
 JavaVirtualTable::JavaVirtualTable(ClassArray* C) {
@@ -1348,8 +1350,9 @@
   // (3) Set depth and display for fast dynamic type checking.
   depth = 1;
   mvm::BumpPtrAllocator& allocator = cl->classLoader->allocator;
-  display = (CommonClass**)allocator.Allocate(sizeof(CommonClass*) * 2);
-  display[0] = C->super;
-  display[1] = C;
+  display = 
+    (JavaVirtualTable**)allocator.Allocate(sizeof(JavaVirtualTable*) * 2);
+  display[0] = &JavaObjectVT;
+  display[1] = this;
 }
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.h Tue Apr 14 04:17:54 2009
@@ -1338,7 +1338,7 @@
 public:
   CommonClass* cl;
   size_t depth;
-  CommonClass** display;
+  JavaVirtualTable** display;
 
   uintptr_t init;
   uintptr_t equals;





More information about the vmkit-commits mailing list