[vmkit-commits] [vmkit] r61133 - /vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Dec 17 06:01:49 PST 2008


Author: geoffray
Date: Wed Dec 17 08:01:32 2008
New Revision: 61133

URL: http://llvm.org/viewvc/llvm-project?rev=61133&view=rev
Log:
Do not allocate the JavaObject::VT twice...


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmModule.cpp Wed Dec 17 08:01:32 2008
@@ -387,7 +387,7 @@
     assert(super->virtualVT && "Super does not have a VT!");
     memcpy(VT, super->virtualVT, cl->super->virtualTableSize * sizeof(void*));
   } else {
-    memcpy(VT, JavaObject::VT, VT_SIZE);
+    VT = JavaObject::VT;
   }
   return VT;
 }
@@ -509,7 +509,7 @@
         BasicBlock::iterator I = BB->begin();
         if (isa<ReturnInst>(I)) {
           ((void**)VT)[0] = 0;
-        } else {
+        } else if (!staticCompilation) {
           // LLVM does not allow recursive compilation. Create the code now.
           ((void**)VT)[0] = EE->getPointerToFunction(func);
         }
@@ -533,10 +533,10 @@
            (void*)((uintptr_t)VT + VT_SIZE), size);
 
     COPY(JavaArray)
-    COPY(JavaObject)
     COPY(ArrayObject)
 
 #undef COPY
+
    }
 #endif
   
@@ -1115,27 +1115,23 @@
   
   ClassReadyConstant = ConstantInt::get(Type::Int32Ty, ready);
  
-  Constant* consPrim = 
-    ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
-                                               uint64(JavaArray::VT)),
-                              VTType);
-  
-  Constant* consRef = 
-    ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
-                                               uint64(ArrayObject::VT)),
-                              VTType);
 
   if (staticCompilation) {
     PrimitiveArrayVT = new GlobalVariable(VTType, false, 
                                           GlobalValue::ExternalLinkage,
-                                          consPrim, "", this);
+                                          0, "", this);
   
     ReferenceArrayVT = new GlobalVariable(VTType, false, 
                                           GlobalValue::ExternalLinkage,
-                                          consRef, "", this);
+                                          0, "", this);
   } else {
-    PrimitiveArrayVT = consPrim;
-    ReferenceArrayVT = consRef;
+    PrimitiveArrayVT = ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
+                                                         uint64(JavaArray::VT)),
+                                                 VTType);
+  
+    ReferenceArrayVT = ConstantExpr::getIntToPtr(ConstantInt::get(Type::Int64Ty,
+                                                       uint64(ArrayObject::VT)),
+                                                 VTType);
   }
 
   LLVMAssessorInfo::initialise();





More information about the vmkit-commits mailing list