comparison src/share/vm/prims/jvmtiTagMap.cpp @ 6738:ec98e58952b2

7197350: NPG: jvmtiHeapReferenceCallback receives incorrect reference_kind for system class roots Summary: Fix the iteration over the system classes and report the correct reference kind. Reviewed-by: coleenp, rbackman
author stefank
date Tue, 11 Sep 2012 14:59:23 +0200
parents aed758eda82a
children d8ce2825b193 bbeecede56dd
comparison
equal deleted inserted replaced
6737:4bfe8b33cf66 6738:ec98e58952b2
2550 oop o = *obj_p; 2550 oop o = *obj_p;
2551 if (o == NULL || o == JNIHandles::deleted_handle()) { 2551 if (o == NULL || o == JNIHandles::deleted_handle()) {
2552 return; 2552 return;
2553 } 2553 }
2554 2554
2555 assert(Universe::heap()->is_in_reserved(o), "should be impossible");
2556
2555 jvmtiHeapReferenceKind kind = root_kind(); 2557 jvmtiHeapReferenceKind kind = root_kind();
2556 2558 if (kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
2557 assert(Universe::heap()->is_in_reserved(o), "should be impossible");
2558 // SystemDictionary::always_strong_oops_do reports the application 2559 // SystemDictionary::always_strong_oops_do reports the application
2559 // class loader as a root. We want this root to be reported as 2560 // class loader as a root. We want this root to be reported as
2560 // a root kind of "OTHER" rather than "SYSTEM_CLASS". 2561 // a root kind of "OTHER" rather than "SYSTEM_CLASS".
2561 if (o->is_instance() && root_kind() == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) { 2562 if (!o->is_instanceMirror()) {
2562 kind = JVMTI_HEAP_REFERENCE_OTHER; 2563 kind = JVMTI_HEAP_REFERENCE_OTHER;
2563 } 2564 }
2565 }
2564 2566
2565 // some objects are ignored - in the case of simple 2567 // some objects are ignored - in the case of simple
2566 // roots it's mostly Symbol*s that we are skipping 2568 // roots it's mostly Symbol*s that we are skipping
2567 // here. 2569 // here.
2568 if (!ServiceUtil::visible_oop(o)) { 2570 if (!ServiceUtil::visible_oop(o)) {
2989 } 2991 }
2990 2992
2991 // Preloaded classes and loader from the system dictionary 2993 // Preloaded classes and loader from the system dictionary
2992 blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS); 2994 blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS);
2993 SystemDictionary::always_strong_oops_do(&blk); 2995 SystemDictionary::always_strong_oops_do(&blk);
2994 ClassLoaderDataGraph::always_strong_oops_do(&blk, NULL, false); 2996 KlassToOopClosure klass_blk(&blk);
2997 ClassLoaderDataGraph::always_strong_oops_do(&blk, &klass_blk, false);
2995 if (blk.stopped()) { 2998 if (blk.stopped()) {
2996 return false; 2999 return false;
2997 } 3000 }
2998 3001
2999 // Inflated monitors 3002 // Inflated monitors