[vmkit-commits] [vmkit] r69280 - in /vmkit/trunk/lib/JnJVM/VMCore: JnjvmClassLoader.cpp VirtualTables.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Apr 16 03:20:17 PDT 2009


Author: geoffray
Date: Thu Apr 16 05:20:08 2009
New Revision: 69280

URL: http://llvm.org/viewvc/llvm-project?rev=69280&view=rev
Log:
When a class loader initiates loading of a class, we add it to its
class map. This allows to record which class loaders are referenced
by a class loader.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
    vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Thu Apr 16 05:20:08 2009
@@ -401,6 +401,15 @@
     vm->noClassDefFoundError(name);
   }
 
+  if (cl && cl->classLoader != this) {
+    classes->lock.lock();
+    ClassMap::iterator End = classes->map.end();
+    ClassMap::iterator I = classes->map.find(name);
+    if (I == End)
+      classes->map.insert(std::make_pair(name, cl));
+    classes->lock.unlock();
+  }
+
   return cl;
 }
 

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

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/VirtualTables.cpp Thu Apr 16 05:20:08 2009
@@ -120,10 +120,9 @@
 //     own class loader.
 // (2) The delegatee object (java.lang.Class) if it exists.
 //
-// Additionaly, non-primitive and non-array classes mus trace:
+// Additionaly, non-primitive and non-array classes must trace:
 // (3) The bytes that represent the class file.
 // (4) The static instance.
-// (5) The class loaders referenced indirectly in the class file (TODO).
 //===----------------------------------------------------------------------===//
 
 
@@ -165,15 +164,17 @@
 
 //===----------------------------------------------------------------------===//
 // Support for scanning a classloader. A classloader must trace:
-// (1) All the classes it has loaded.
-// (2) All the strings referenced in class files.
+// (1) All the classes it has loaded (located in the classmap).
+// (2) All the class it has initiated loading and therefore references (located
+//     in the classmap).
+// (3) All the strings referenced in class files.
 //
 // The class loader does not need to trace its java.lang.Classloader Java object
 // because if we end up here, this means that the Java object is already being
 // scanned. Only the Java object traces the class loader.
 //
 // Additionaly, the bootstrap loader must trace:
-// (3) The delegatees of native array classes. Since these classes are not in
+// (4) The delegatees of native array classes. Since these classes are not in
 //     the class map and they are not GC-allocated, we must trace the objects
 //     referenced by the delegatees.
 //===----------------------------------------------------------------------===//





More information about the vmkit-commits mailing list