hotspot/src/share/vm/prims/jvmtiTagMap.cpp
changeset 13741 e4395deb8597
parent 13738 d67be49a5beb
child 13976 93a075193661
child 13952 e3cf184080bc
--- a/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Mon Sep 10 16:37:22 2012 -0700
+++ b/hotspot/src/share/vm/prims/jvmtiTagMap.cpp	Tue Sep 11 14:59:23 2012 +0200
@@ -2552,15 +2552,17 @@
       return;
     }
 
+    assert(Universe::heap()->is_in_reserved(o), "should be impossible");
+
     jvmtiHeapReferenceKind kind = root_kind();
-
-    assert(Universe::heap()->is_in_reserved(o), "should be impossible");
+    if (kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
       // SystemDictionary::always_strong_oops_do reports the application
       // class loader as a root. We want this root to be reported as
       // a root kind of "OTHER" rather than "SYSTEM_CLASS".
-      if (o->is_instance() && root_kind() == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
+      if (!o->is_instanceMirror()) {
         kind = JVMTI_HEAP_REFERENCE_OTHER;
       }
+    }
 
     // some objects are ignored - in the case of simple
     // roots it's mostly Symbol*s that we are skipping
@@ -2991,7 +2993,8 @@
   // Preloaded classes and loader from the system dictionary
   blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS);
   SystemDictionary::always_strong_oops_do(&blk);
-  ClassLoaderDataGraph::always_strong_oops_do(&blk, NULL, false);
+  KlassToOopClosure klass_blk(&blk);
+  ClassLoaderDataGraph::always_strong_oops_do(&blk, &klass_blk, false);
   if (blk.stopped()) {
     return false;
   }