--- old/src/hotspot/share/gc/g1/g1HeapVerifier.cpp 2017-09-25 13:06:26.400052353 -0400 +++ new/src/hotspot/share/gc/g1/g1HeapVerifier.cpp 2017-09-25 13:06:25.971139025 -0400 @@ -161,18 +161,19 @@ void reset_count() { _count = 0; }; }; -class VerifyKlassClosure: public KlassClosure { +class VerifyCLDClosure: public CLDClosure { YoungRefCounterClosure _young_ref_counter_closure; OopClosure *_oop_closure; + G1CollectedHeap* _g1h; public: - VerifyKlassClosure(G1CollectedHeap* g1h, OopClosure* cl) : _young_ref_counter_closure(g1h), _oop_closure(cl) {} - void do_klass(Klass* k) { - k->oops_do(_oop_closure); + VerifyCLDClosure(G1CollectedHeap* g1h, OopClosure* cl) : _g1h(g1h), _young_ref_counter_closure(g1h), _oop_closure(cl) {} + void do_cld(ClassLoaderData* cld) { + cld->oops_do(_oop_closure, false); _young_ref_counter_closure.reset_count(); - k->oops_do(&_young_ref_counter_closure); + cld->oops_do(&_young_ref_counter_closure, false); if (_young_ref_counter_closure.count() > 0) { - guarantee(k->has_modified_oops(), "Klass " PTR_FORMAT ", has young refs but is not dirty.", p2i(k)); + guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count()); } } }; @@ -390,8 +391,7 @@ log_debug(gc, verify)("Roots"); VerifyRootsClosure rootsCl(vo); - VerifyKlassClosure klassCl(_g1h, &rootsCl); - CLDToKlassAndOopClosure cldCl(&klassCl, &rootsCl, false); + VerifyCLDClosure cldCl(_g1h, &rootsCl); // We apply the relevant closures to all the oops in the // system dictionary, class loader data graph, the string table