hotspot/src/share/vm/classfile/systemDictionary.cpp
changeset 13753 1df4fd11c5b8
parent 13738 d67be49a5beb
child 13929 8da0dc50a6e4
child 13952 e3cf184080bc
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Thu Sep 13 21:20:26 2012 +0200
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Mon Sep 17 10:46:59 2012 -0400
@@ -1496,6 +1496,19 @@
   int d_index = dictionary()->hash_to_index(d_hash);
   check_constraints(d_index, d_hash, k, class_loader_h, true, CHECK);
 
+  // Register class just loaded with class loader (placed in Vector)
+  // Note we do this before updating the dictionary, as this can
+  // fail with an OutOfMemoryError (if it does, we will *not* put this
+  // class in the dictionary and will not update the class hierarchy).
+  // JVMTI FollowReferences needs to find the classes this way.
+  if (k->class_loader() != NULL) {
+    methodHandle m(THREAD, Universe::loader_addClass_method());
+    JavaValue result(T_VOID);
+    JavaCallArguments args(class_loader_h);
+    args.push_oop(Handle(THREAD, k->java_mirror()));
+    JavaCalls::call(&result, m, &args, CHECK);
+  }
+
   // Add the new class. We need recompile lock during update of CHA.
   {
     unsigned int p_hash = placeholders()->compute_hash(name_h, loader_data);