[vmkit-commits] [vmkit] r69279 - /vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Apr 16 02:07:04 PDT 2009


Author: geoffray
Date: Thu Apr 16 04:07:00 2009
New Revision: 69279

URL: http://llvm.org/viewvc/llvm-project?rev=69279&view=rev
Log:
Instead of loader super and interfaces when a class is resolved,
load it when the class is being loaded.


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

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JavaClass.cpp Thu Apr 16 04:07:00 2009
@@ -726,7 +726,10 @@
   uint16 superEntry = reader.readU2();
   // Use the depth field to store the super entry, to not touch super. The
   // super field is used during GC scanning and must only be of one type.
-  depth = superEntry;
+  if (superEntry) {
+    const UTF8* superUTF8 = ctpInfo->resolveClassName(superEntry);
+    super = classLoader->loadName(superUTF8, false, true);
+  }
 
   uint16 nbI = reader.readU2();
 
@@ -737,27 +740,26 @@
   interfaces = (Class**)
     classLoader->allocator.Allocate(nbI * sizeof(Class*));
   nbInterfaces = nbI;
-  for (int i = 0; i < nbI; i++)
-    interfaces[i] = (Class*)ctpInfo->resolveClassName(reader.readU2());
+  for (int i = 0; i < nbI; i++) {
+    const UTF8* name = ctpInfo->resolveClassName(reader.readU2());
+    interfaces[i] = classLoader->loadName(name, false, true);
+  }
 
 }
 
 void UserClass::loadParents() {
-  const UTF8* superUTF8 = depth ? ctpInfo->resolveClassName(depth) : 0;
   // W prevent the GC from scanning the interfaces until they
   // are loaded. So we temporarly consider that this class does not
   // have any interfaces. This is harmless because the class is being
   // resolved and can not be used elsewhere for getting its interfaces.
-  uint32 realNbInterfaces = nbInterfaces;
-  nbInterfaces = 0;
-  if (superUTF8 == 0) {
+  if (super == 0) {
     depth = 0;
     display = (CommonClass**)
       classLoader->allocator.Allocate(sizeof(CommonClass*));
     display[0] = this;
     virtualTableSize = JavaVirtualTable::getFirstJavaMethodIndex();
   } else {
-    super = classLoader->loadName(superUTF8, true, true);
+    super->resolveClass();
     depth = super->depth + 1;
     mvm::BumpPtrAllocator& allocator = classLoader->allocator;
     display = (CommonClass**)
@@ -767,13 +769,8 @@
     virtualTableSize = super->virtualTableSize;
   }
 
-  for (unsigned i = 0; i < realNbInterfaces; i++)
-    interfaces[i] = 
-      ((UserClass*)classLoader->loadName((const UTF8*)interfaces[i],
-                                         true, true));
-
-  // Interfaces are loaded, put the real number back in place.
-  nbInterfaces = realNbInterfaces;
+  for (unsigned i = 0; i < nbInterfaces; i++)
+    interfaces[i]->resolveClass(); 
 }
 
 





More information about the vmkit-commits mailing list