diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 047171a5eb364..f3b3c8952b917 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -846,7 +846,15 @@ void DefNewGeneration::verify() { } void DefNewGeneration::print_on(outputStream* st) const { - Generation::print_on(st); + st->print(" %-10s", name()); + + st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + capacity()/K, used()/K); + st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", + p2i(_virtual_space.low_boundary()), + p2i(_virtual_space.high()), + p2i(_virtual_space.high_boundary())); + st->print(" eden"); eden()->print_on(st); st->print(" from"); @@ -855,11 +863,6 @@ void DefNewGeneration::print_on(outputStream* st) const { to()->print_on(st); } - -const char* DefNewGeneration::name() const { - return "def new generation"; -} - HeapWord* DefNewGeneration::allocate(size_t word_size) { // This is the slow-path allocation for the DefNewGeneration. // Most allocations are fast-path in compiled code. diff --git a/src/hotspot/share/gc/serial/defNewGeneration.hpp b/src/hotspot/share/gc/serial/defNewGeneration.hpp index c5b7c095ac4e6..e86ea6b97476c 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.hpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.hpp @@ -234,8 +234,7 @@ class DefNewGeneration: public Generation { void update_counters(); // Printing - virtual const char* name() const; - virtual const char* short_name() const { return "DefNew"; } + const char* name() const { return "DefNew"; } void print_on(outputStream* st) const; diff --git a/src/hotspot/share/gc/serial/generation.cpp b/src/hotspot/share/gc/serial/generation.cpp index 5d3b7fe2fe3c4..b15b071d7103f 100644 --- a/src/hotspot/share/gc/serial/generation.cpp +++ b/src/hotspot/share/gc/serial/generation.cpp @@ -58,15 +58,3 @@ Generation::Generation(ReservedSpace rs, size_t initial_size) : size_t Generation::max_capacity() const { return reserved().byte_size(); } - -void Generation::print() const { print_on(tty); } - -void Generation::print_on(outputStream* st) const { - st->print(" %-20s", name()); - st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", - capacity()/K, used()/K); - st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", - p2i(_virtual_space.low_boundary()), - p2i(_virtual_space.high()), - p2i(_virtual_space.high_boundary())); -} diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index c6a9f94a8703a..e13b42956e1af 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -103,13 +103,6 @@ class Generation: public CHeapObj<mtGC> { return _reserved.contains(p); } - // Printing - virtual const char* name() const = 0; - virtual const char* short_name() const = 0; - - virtual void print() const; - virtual void print_on(outputStream* st) const; - virtual void verify() = 0; public: diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 3c48177554121..9dcfb5b609204 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -882,12 +882,12 @@ void SerialHeap::verify(VerifyOption option /* ignored */) { } void SerialHeap::print_on(outputStream* st) const { - if (_young_gen != nullptr) { - _young_gen->print_on(st); - } - if (_old_gen != nullptr) { - _old_gen->print_on(st); - } + assert(_young_gen != nullptr, "precondition"); + assert(_old_gen != nullptr, "precondition"); + + _young_gen->print_on(st); + _old_gen->print_on(st); + MetaspaceUtils::print_on(st); } @@ -908,7 +908,7 @@ void SerialHeap::print_heap_change(const PreGenGCValues& pre_gc_values) const { log_info(gc, heap)(HEAP_CHANGE_FORMAT" " HEAP_CHANGE_FORMAT" " HEAP_CHANGE_FORMAT, - HEAP_CHANGE_FORMAT_ARGS(def_new_gen->short_name(), + HEAP_CHANGE_FORMAT_ARGS(def_new_gen->name(), pre_gc_values.young_gen_used(), pre_gc_values.young_gen_capacity(), def_new_gen->used(), @@ -924,7 +924,7 @@ void SerialHeap::print_heap_change(const PreGenGCValues& pre_gc_values) const { def_new_gen->from()->used(), def_new_gen->from()->capacity())); log_info(gc, heap)(HEAP_CHANGE_FORMAT, - HEAP_CHANGE_FORMAT_ARGS(old_gen()->short_name(), + HEAP_CHANGE_FORMAT_ARGS(old_gen()->name(), pre_gc_values.old_gen_used(), pre_gc_values.old_gen_capacity(), old_gen()->used(), diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.cpp b/src/hotspot/share/gc/serial/tenuredGeneration.cpp index febc4713d0372..99031c379d811 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.cpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.cpp @@ -440,7 +440,15 @@ void TenuredGeneration::verify() { } void TenuredGeneration::print_on(outputStream* st) const { - Generation::print_on(st); + st->print(" %-10s", name()); + + st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", + capacity()/K, used()/K); + st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", + p2i(_virtual_space.low_boundary()), + p2i(_virtual_space.high()), + p2i(_virtual_space.high_boundary())); + st->print(" the"); _the_space->print_on(st); } diff --git a/src/hotspot/share/gc/serial/tenuredGeneration.hpp b/src/hotspot/share/gc/serial/tenuredGeneration.hpp index fc0578d4e4fe4..88bfe6ecf46a8 100644 --- a/src/hotspot/share/gc/serial/tenuredGeneration.hpp +++ b/src/hotspot/share/gc/serial/tenuredGeneration.hpp @@ -121,8 +121,7 @@ class TenuredGeneration: public Generation { CardTableRS* remset); // Printing - const char* name() const { return "tenured generation"; } - const char* short_name() const { return "Tenured"; } + const char* name() const { return "Tenured"; } // Iteration void object_iterate(ObjectClosure* blk);