@@ -2057,16 +2057,6 @@ bool G1CollectedHeap::supports_concurrent_gc_breakpoints() const {
20572057 return true ;
20582058}
20592059
2060- class PrintRegionClosure : public HeapRegionClosure {
2061- outputStream* _st;
2062- public:
2063- PrintRegionClosure (outputStream* st) : _st(st) {}
2064- bool do_heap_region (HeapRegion* r) {
2065- r->print_on (_st);
2066- return false ;
2067- }
2068- };
2069-
20702060bool G1CollectedHeap::is_obj_dead_cond (const oop obj,
20712061 const HeapRegion* hr,
20722062 const VerifyOption vo) const {
@@ -2088,11 +2078,11 @@ bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
20882078 return false ; // keep some compilers happy
20892079}
20902080
2091- void G1CollectedHeap::print_heap_regions () const {
2081+ void G1CollectedHeap::print_heap_regions (bool print_pin_counts ) const {
20922082 LogTarget (Trace, gc, heap, region) lt;
20932083 if (lt.is_enabled ()) {
20942084 LogStream ls (lt);
2095- print_regions_on (&ls);
2085+ print_regions_on (&ls, print_pin_counts );
20962086 }
20972087}
20982088
@@ -2126,13 +2116,25 @@ void G1CollectedHeap::print_on(outputStream* st) const {
21262116 MetaspaceUtils::print_on (st);
21272117}
21282118
2129- void G1CollectedHeap::print_regions_on (outputStream* st) const {
2119+
2120+ class PrintRegionClosure : public HeapRegionClosure {
2121+ outputStream* _st;
2122+ const bool _print_pin_counts;
2123+ public:
2124+ PrintRegionClosure (outputStream* st, bool print_pin_counts) : _st(st), _print_pin_counts(print_pin_counts) {}
2125+ bool do_heap_region (HeapRegion* r) {
2126+ r->print_on (_st, _print_pin_counts);
2127+ return false ;
2128+ }
2129+ };
2130+
2131+ void G1CollectedHeap::print_regions_on (outputStream* st, bool print_pin_counts) const {
21302132 st->print_cr (" Heap Regions: E=young(eden), S=young(survivor), O=old, "
21312133 " HS=humongous(starts), HC=humongous(continues), "
21322134 " CS=collection set, F=free, "
21332135 " TAMS=top-at-mark-start, "
21342136 " PB=parsable bottom" );
2135- PrintRegionClosure blk (st);
2137+ PrintRegionClosure blk (st, print_pin_counts );
21362138 heap_region_iterate (&blk);
21372139}
21382140
@@ -2141,7 +2143,7 @@ void G1CollectedHeap::print_extended_on(outputStream* st) const {
21412143
21422144 // Print the per-region information.
21432145 st->cr ();
2144- print_regions_on (st);
2146+ print_regions_on (st, true /* print_pin_counts */ );
21452147}
21462148
21472149void G1CollectedHeap::print_on_error (outputStream* st) const {
@@ -2422,7 +2424,8 @@ G1HeapPrinterMark::G1HeapPrinterMark(G1CollectedHeap* g1h) : _g1h(g1h), _heap_tr
24222424 _g1h->total_collections (),
24232425 true /* show_thread_times */ );
24242426 _g1h->print_heap_before_gc ();
2425- _g1h->print_heap_regions ();
2427+ // We did not merge in the cached pin counts yet, making the output confusing.
2428+ _g1h->print_heap_regions (false /* print_pin_counts */ );
24262429}
24272430
24282431G1HeapPrinterMark::~G1HeapPrinterMark () {
@@ -2434,7 +2437,7 @@ G1HeapPrinterMark::~G1HeapPrinterMark() {
24342437 false /* show_thread_times */ );
24352438
24362439 _heap_transition.print ();
2437- _g1h->print_heap_regions ();
2440+ _g1h->print_heap_regions (true /* print_pin_counts */ );
24382441 _g1h->print_heap_after_gc ();
24392442 // Print NUMA statistics.
24402443 _g1h->numa ()->print_statistics ();
0 commit comments