mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8353559: Restructure CollectedHeap error printing
Reviewed-by: stefank, eosterlund, ayang
This commit is contained in:
parent
32d6d03151
commit
c494a00a66
@ -310,6 +310,16 @@ void EpsilonHeap::print_on(outputStream *st) const {
|
||||
MetaspaceUtils::print_on(st);
|
||||
}
|
||||
|
||||
void EpsilonHeap::print_on_error(outputStream *st) const {
|
||||
print_on(st);
|
||||
st->cr();
|
||||
|
||||
BarrierSet* bs = BarrierSet::barrier_set();
|
||||
if (bs != nullptr) {
|
||||
bs->print_on(st);
|
||||
}
|
||||
}
|
||||
|
||||
bool EpsilonHeap::print_location(outputStream* st, void* addr) const {
|
||||
return BlockLocationPrinter<EpsilonHeap>::print_location(st, addr);
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2022, Red Hat, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -132,6 +132,7 @@ public:
|
||||
HeapWord* allocate_loaded_archive_space(size_t size) override;
|
||||
|
||||
void print_on(outputStream* st) const override;
|
||||
void print_on_error(outputStream* st) const override;
|
||||
void print_tracing_info() const override;
|
||||
bool print_location(outputStream* st, void* addr) const override;
|
||||
|
||||
|
||||
@ -2161,7 +2161,13 @@ void G1CollectedHeap::print_extended_on(outputStream* st) const {
|
||||
}
|
||||
|
||||
void G1CollectedHeap::print_on_error(outputStream* st) const {
|
||||
this->CollectedHeap::print_on_error(st);
|
||||
print_extended_on(st);
|
||||
st->cr();
|
||||
|
||||
BarrierSet* bs = BarrierSet::barrier_set();
|
||||
if (bs != nullptr) {
|
||||
bs->print_on(st);
|
||||
}
|
||||
|
||||
if (_cm != nullptr) {
|
||||
st->cr();
|
||||
|
||||
@ -1313,7 +1313,7 @@ private:
|
||||
|
||||
public:
|
||||
void print_on(outputStream* st) const override;
|
||||
void print_extended_on(outputStream* st) const override;
|
||||
void print_extended_on(outputStream* st) const;
|
||||
void print_on_error(outputStream* st) const override;
|
||||
|
||||
void gc_threads_do(ThreadClosure* tc) const override;
|
||||
|
||||
@ -673,7 +673,13 @@ void ParallelScavengeHeap::print_on(outputStream* st) const {
|
||||
}
|
||||
|
||||
void ParallelScavengeHeap::print_on_error(outputStream* st) const {
|
||||
this->CollectedHeap::print_on_error(st);
|
||||
print_on(st);
|
||||
st->cr();
|
||||
|
||||
BarrierSet* bs = BarrierSet::barrier_set();
|
||||
if (bs != nullptr) {
|
||||
bs->print_on(st);
|
||||
}
|
||||
|
||||
st->cr();
|
||||
PSParallelCompact::print_on_error(st);
|
||||
|
||||
@ -810,6 +810,16 @@ void SerialHeap::print_on(outputStream* st) const {
|
||||
MetaspaceUtils::print_on(st);
|
||||
}
|
||||
|
||||
void SerialHeap::print_on_error(outputStream* st) const {
|
||||
print_on(st);
|
||||
st->cr();
|
||||
|
||||
BarrierSet* bs = BarrierSet::barrier_set();
|
||||
if (bs != nullptr) {
|
||||
bs->print_on(st);
|
||||
}
|
||||
}
|
||||
|
||||
void SerialHeap::gc_threads_do(ThreadClosure* tc) const {
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -207,6 +207,7 @@ public:
|
||||
void verify(VerifyOption option) override;
|
||||
|
||||
void print_on(outputStream* st) const override;
|
||||
void print_on_error(outputStream* st) const override;
|
||||
void gc_threads_do(ThreadClosure* tc) const override;
|
||||
void print_tracing_info() const override;
|
||||
|
||||
|
||||
@ -188,17 +188,6 @@ void CollectedHeap::print_heap_after_gc() {
|
||||
|
||||
void CollectedHeap::print() const { print_on(tty); }
|
||||
|
||||
void CollectedHeap::print_on_error(outputStream* st) const {
|
||||
st->print_cr("Heap:");
|
||||
print_extended_on(st);
|
||||
st->cr();
|
||||
|
||||
BarrierSet* bs = BarrierSet::barrier_set();
|
||||
if (bs != nullptr) {
|
||||
bs->print_on(st);
|
||||
}
|
||||
}
|
||||
|
||||
void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {
|
||||
const GCHeapSummary& heap_summary = create_heap_summary();
|
||||
gc_tracer->report_gc_heap_summary(when, heap_summary);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -440,15 +440,7 @@ protected:
|
||||
// The default behavior is to call print_on() on tty.
|
||||
virtual void print() const;
|
||||
|
||||
// Print more detailed heap information on the given
|
||||
// outputStream. The default behavior is to call print_on(). It is
|
||||
// up to each subclass to override it and add any additional output
|
||||
// it needs.
|
||||
virtual void print_extended_on(outputStream* st) const {
|
||||
print_on(st);
|
||||
}
|
||||
|
||||
virtual void print_on_error(outputStream* st) const;
|
||||
virtual void print_on_error(outputStream* st) const = 0;
|
||||
|
||||
// Used to print information about locations in the hs_err file.
|
||||
virtual bool print_location(outputStream* st, void* addr) const = 0;
|
||||
|
||||
@ -649,6 +649,12 @@ void ShenandoahHeap::print_on(outputStream* st) const {
|
||||
}
|
||||
}
|
||||
|
||||
void ShenandoahHeap::print_on_error(outputStream* st) const {
|
||||
print_on(st);
|
||||
st->cr();
|
||||
print_heap_regions_on(st);
|
||||
}
|
||||
|
||||
class ShenandoahInitWorkerGCLABClosure : public ThreadClosure {
|
||||
public:
|
||||
void do_thread(Thread* thread) {
|
||||
@ -2582,12 +2588,6 @@ void ShenandoahHeap::rebuild_free_set(bool concurrent) {
|
||||
}
|
||||
}
|
||||
|
||||
void ShenandoahHeap::print_extended_on(outputStream *st) const {
|
||||
print_on(st);
|
||||
st->cr();
|
||||
print_heap_regions_on(st);
|
||||
}
|
||||
|
||||
bool ShenandoahHeap::is_bitmap_slice_committed(ShenandoahHeapRegion* r, bool skip_self) {
|
||||
size_t slice = r->index() / _bitmap_regions_per_slice;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2021, Red Hat, Inc. All rights reserved.
|
||||
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
@ -203,7 +203,7 @@ public:
|
||||
void initialize_serviceability() override;
|
||||
|
||||
void print_on(outputStream* st) const override;
|
||||
void print_extended_on(outputStream *st) const override;
|
||||
void print_on_error(outputStream *st) const override;
|
||||
void print_tracing_info() const override;
|
||||
void print_heap_regions_on(outputStream* st) const;
|
||||
|
||||
|
||||
@ -359,33 +359,7 @@ void ZCollectedHeap::print_on(outputStream* st) const {
|
||||
}
|
||||
|
||||
void ZCollectedHeap::print_on_error(outputStream* st) const {
|
||||
st->print_cr("ZGC Globals:");
|
||||
st->print_cr(" Young Collection: %s/%u", ZGeneration::young()->phase_to_string(), ZGeneration::young()->seqnum());
|
||||
st->print_cr(" Old Collection: %s/%u", ZGeneration::old()->phase_to_string(), ZGeneration::old()->seqnum());
|
||||
st->print_cr(" Offset Max: " EXACTFMT " (" PTR_FORMAT ")", EXACTFMTARGS(ZAddressOffsetMax), ZAddressOffsetMax);
|
||||
st->print_cr(" Page Size Small: %zuM", ZPageSizeSmall / M);
|
||||
st->print_cr(" Page Size Medium: %zuM", ZPageSizeMedium / M);
|
||||
st->cr();
|
||||
st->print_cr("ZGC Metadata Bits:");
|
||||
st->print_cr(" LoadGood: " PTR_FORMAT, ZPointerLoadGoodMask);
|
||||
st->print_cr(" LoadBad: " PTR_FORMAT, ZPointerLoadBadMask);
|
||||
st->print_cr(" MarkGood: " PTR_FORMAT, ZPointerMarkGoodMask);
|
||||
st->print_cr(" MarkBad: " PTR_FORMAT, ZPointerMarkBadMask);
|
||||
st->print_cr(" StoreGood: " PTR_FORMAT, ZPointerStoreGoodMask);
|
||||
st->print_cr(" StoreBad: " PTR_FORMAT, ZPointerStoreBadMask);
|
||||
st->print_cr(" ------------------- ");
|
||||
st->print_cr(" Remapped: " PTR_FORMAT, ZPointerRemapped);
|
||||
st->print_cr(" RemappedYoung: " PTR_FORMAT, ZPointerRemappedYoungMask);
|
||||
st->print_cr(" RemappedOld: " PTR_FORMAT, ZPointerRemappedOldMask);
|
||||
st->print_cr(" MarkedYoung: " PTR_FORMAT, ZPointerMarkedYoung);
|
||||
st->print_cr(" MarkedOld: " PTR_FORMAT, ZPointerMarkedOld);
|
||||
st->print_cr(" Remembered: " PTR_FORMAT, ZPointerRemembered);
|
||||
st->cr();
|
||||
CollectedHeap::print_on_error(st);
|
||||
}
|
||||
|
||||
void ZCollectedHeap::print_extended_on(outputStream* st) const {
|
||||
_heap.print_extended_on(st);
|
||||
_heap.print_on_error(st);
|
||||
}
|
||||
|
||||
void ZCollectedHeap::print_tracing_info() const {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -117,7 +117,6 @@ public:
|
||||
|
||||
void print_on(outputStream* st) const override;
|
||||
void print_on_error(outputStream* st) const override;
|
||||
void print_extended_on(outputStream* st) const override;
|
||||
void print_tracing_info() const override;
|
||||
bool print_location(outputStream* st, void* addr) const override;
|
||||
|
||||
|
||||
@ -326,10 +326,41 @@ void ZHeap::print_on(outputStream* st) const {
|
||||
MetaspaceUtils::print_on(st);
|
||||
}
|
||||
|
||||
void ZHeap::print_extended_on(outputStream* st) const {
|
||||
void ZHeap::print_on_error(outputStream* st) const {
|
||||
print_on(st);
|
||||
st->cr();
|
||||
|
||||
print_globals_on(st);
|
||||
st->cr();
|
||||
|
||||
print_page_table_on(st);
|
||||
}
|
||||
|
||||
void ZHeap::print_globals_on(outputStream* st) const {
|
||||
st->print_cr("ZGC Globals:");
|
||||
st->print_cr(" Young Collection: %s/%u", ZGeneration::young()->phase_to_string(), ZGeneration::young()->seqnum());
|
||||
st->print_cr(" Old Collection: %s/%u", ZGeneration::old()->phase_to_string(), ZGeneration::old()->seqnum());
|
||||
st->print_cr(" Offset Max: " EXACTFMT " (" PTR_FORMAT ")", EXACTFMTARGS(ZAddressOffsetMax), ZAddressOffsetMax);
|
||||
st->print_cr(" Page Size Small: %zuM", ZPageSizeSmall / M);
|
||||
st->print_cr(" Page Size Medium: %zuM", ZPageSizeMedium / M);
|
||||
st->cr();
|
||||
st->print_cr("ZGC Metadata Bits:");
|
||||
st->print_cr(" LoadGood: " PTR_FORMAT, ZPointerLoadGoodMask);
|
||||
st->print_cr(" LoadBad: " PTR_FORMAT, ZPointerLoadBadMask);
|
||||
st->print_cr(" MarkGood: " PTR_FORMAT, ZPointerMarkGoodMask);
|
||||
st->print_cr(" MarkBad: " PTR_FORMAT, ZPointerMarkBadMask);
|
||||
st->print_cr(" StoreGood: " PTR_FORMAT, ZPointerStoreGoodMask);
|
||||
st->print_cr(" StoreBad: " PTR_FORMAT, ZPointerStoreBadMask);
|
||||
st->print_cr(" ------------------- ");
|
||||
st->print_cr(" Remapped: " PTR_FORMAT, ZPointerRemapped);
|
||||
st->print_cr(" RemappedYoung: " PTR_FORMAT, ZPointerRemappedYoungMask);
|
||||
st->print_cr(" RemappedOld: " PTR_FORMAT, ZPointerRemappedOldMask);
|
||||
st->print_cr(" MarkedYoung: " PTR_FORMAT, ZPointerMarkedYoung);
|
||||
st->print_cr(" MarkedOld: " PTR_FORMAT, ZPointerMarkedOld);
|
||||
st->print_cr(" Remembered: " PTR_FORMAT, ZPointerRemembered);
|
||||
}
|
||||
|
||||
void ZHeap::print_page_table_on(outputStream* st) const {
|
||||
// Do not allow pages to be deleted
|
||||
_page_allocator.enable_safe_destroy();
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -132,7 +132,9 @@ public:
|
||||
|
||||
// Printing
|
||||
void print_on(outputStream* st) const;
|
||||
void print_extended_on(outputStream* st) const;
|
||||
void print_on_error(outputStream* st) const;
|
||||
void print_globals_on(outputStream* st) const;
|
||||
void print_page_table_on(outputStream* st) const;
|
||||
bool print_location(outputStream* st, uintptr_t addr) const;
|
||||
bool print_location(outputStream* st, zaddress addr) const;
|
||||
bool print_location(outputStream* st, zpointer ptr) const;
|
||||
|
||||
@ -1191,6 +1191,7 @@ void VMError::report(outputStream* st, bool _verbose) {
|
||||
GCLogPrecious::print_on_error(st);
|
||||
|
||||
if (Universe::heap() != nullptr) {
|
||||
st->print_cr("Heap:");
|
||||
Universe::heap()->print_on_error(st);
|
||||
st->cr();
|
||||
}
|
||||
@ -1374,6 +1375,7 @@ void VMError::print_vm_info(outputStream* st) {
|
||||
if (Universe::is_fully_initialized()) {
|
||||
MutexLocker hl(Heap_lock);
|
||||
GCLogPrecious::print_on_error(st);
|
||||
st->print_cr("Heap:");
|
||||
Universe::heap()->print_on_error(st);
|
||||
st->cr();
|
||||
st->print_cr("Polling page: " PTR_FORMAT, p2i(SafepointMechanism::get_polling_page()));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user