8326763: Consolidate print methods in ContiguousSpace

Reviewed-by: stefank, gli
This commit is contained in:
Albert Mingkun Yang 2024-02-28 15:14:43 +00:00
parent 41242cbe5d
commit a93605f7fb
2 changed files with 4 additions and 14 deletions
src/hotspot/share/gc/shared

@ -99,20 +99,12 @@ void ContiguousSpace::mangle_unused_area_complete() {
}
#endif // NOT_PRODUCT
void ContiguousSpace::print_short() const { print_short_on(tty); }
void ContiguousSpace::print_short_on(outputStream* st) const {
st->print(" space " SIZE_FORMAT "K, %3d%% used", capacity() / K,
(int) ((double) used() * 100 / capacity()));
}
void ContiguousSpace::print() const { print_on(tty); }
void ContiguousSpace::print_on(outputStream* st) const {
print_short_on(st);
st->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
p2i(bottom()), p2i(top()), p2i(end()));
st->print_cr(" space %zuK, %3d%% used [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
capacity() / K, (int) ((double) used() * 100 / capacity()),
p2i(bottom()), p2i(top()), p2i(end()));
}
void ContiguousSpace::verify() const {

@ -127,9 +127,7 @@ public:
size_t free() const { return byte_size(top(), end()); }
void print() const;
virtual void print_on(outputStream* st) const;
void print_short() const;
void print_short_on(outputStream* st) const;
void print_on(outputStream* st) const;
// Initialization.
// "initialize" should be called once on a space, before it is used for