8246258: Enable hs_err heap printing earlier during initialization

Reviewed-by: stuefe, sjohanss
This commit is contained in:
Stefan Karlsson 2020-06-02 09:57:35 +02:00
parent a180444c6f
commit b5678a43cc
7 changed files with 46 additions and 17 deletions

@ -286,8 +286,10 @@ void EpsilonHeap::print_on(outputStream *st) const {
// Cast away constness:
((VirtualSpace)_virtual_space).print_on(st);
st->print_cr("Allocation space:");
_space->print_on(st);
if (_space != NULL) {
st->print_cr("Allocation space:");
_space->print_on(st);
}
MetaspaceUtils::print_on(st);
}

@ -52,7 +52,8 @@ public:
static EpsilonHeap* heap();
EpsilonHeap() :
_memory_manager("Epsilon Heap", "") {};
_memory_manager("Epsilon Heap", ""),
_space(NULL) {};
virtual Name kind() const {
return CollectedHeap::Epsilon;

@ -2507,11 +2507,13 @@ void G1CollectedHeap::print_heap_regions() const {
void G1CollectedHeap::print_on(outputStream* st) const {
st->print(" %-20s", "garbage-first heap");
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K);
st->print(" [" PTR_FORMAT ", " PTR_FORMAT ")",
p2i(_hrm->reserved().start()),
p2i(_hrm->reserved().end()));
if (_hrm != NULL) {
st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
capacity()/K, used_unlocked()/K);
st->print(" [" PTR_FORMAT ", " PTR_FORMAT ")",
p2i(_hrm->reserved().start()),
p2i(_hrm->reserved().end()));
}
st->cr();
st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
uint young_regions = young_regions_count();
@ -2526,7 +2528,8 @@ void G1CollectedHeap::print_on(outputStream* st) const {
st->print(" remaining free region(s) on each NUMA node: ");
const int* node_ids = _numa->node_ids();
for (uint node_index = 0; node_index < num_nodes; node_index++) {
st->print("%d=%u ", node_ids[node_index], _hrm->num_free_regions(node_index));
uint num_free_regions = (_hrm != NULL ? _hrm->num_free_regions(node_index) : 0);
st->print("%d=%u ", node_ids[node_index], num_free_regions);
}
st->cr();
}
@ -2534,6 +2537,10 @@ void G1CollectedHeap::print_on(outputStream* st) const {
}
void G1CollectedHeap::print_regions_on(outputStream* st) const {
if (_hrm == NULL) {
return;
}
st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
"HS=humongous(starts), HC=humongous(continues), "
"CS=collection set, F=free, "

@ -595,8 +595,12 @@ bool ParallelScavengeHeap::print_location(outputStream* st, void* addr) const {
}
void ParallelScavengeHeap::print_on(outputStream* st) const {
young_gen()->print_on(st);
old_gen()->print_on(st);
if (young_gen() != NULL) {
young_gen()->print_on(st);
}
if (old_gen() != NULL) {
old_gen()->print_on(st);
}
MetaspaceUtils::print_on(st);
}

@ -143,7 +143,10 @@ void CollectedHeap::print_on_error(outputStream* st) const {
print_extended_on(st);
st->cr();
BarrierSet::barrier_set()->print_on(st);
BarrierSet* bs = BarrierSet::barrier_set();
if (bs != NULL) {
bs->print_on(st);
}
}
void CollectedHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_tracer) {

@ -82,6 +82,8 @@ GenCollectedHeap::GenCollectedHeap(Generation::Name young,
Generation::Name old,
const char* policy_counters_name) :
CollectedHeap(),
_young_gen(NULL),
_old_gen(NULL),
_young_gen_spec(new GenerationSpec(young,
NewSize,
MaxNewSize,
@ -92,9 +94,13 @@ GenCollectedHeap::GenCollectedHeap(Generation::Name young,
GenAlignment)),
_rem_set(NULL),
_soft_ref_gen_policy(),
_size_policy(NULL),
_gc_policy_counters(new GCPolicyCounters(policy_counters_name, 2, 2)),
_incremental_collection_failed(false),
_full_collections_completed(0),
_process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)) {
_process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),
_young_manager(NULL),
_old_manager(NULL) {
}
jint GenCollectedHeap::initialize() {
@ -129,7 +135,6 @@ jint GenCollectedHeap::initialize() {
old_rs = old_rs.first_part(_old_gen_spec->max_size());
_old_gen = _old_gen_spec->init(old_rs, rem_set());
clear_incremental_collection_failed();
GCInitLogger::print();
@ -1220,8 +1225,12 @@ void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
}
void GenCollectedHeap::print_on(outputStream* st) const {
_young_gen->print_on(st);
_old_gen->print_on(st);
if (_young_gen != NULL) {
_young_gen->print_on(st);
}
if (_old_gen != NULL) {
_old_gen->print_on(st);
}
MetaspaceUtils::print_on(st);
}

@ -931,9 +931,12 @@ void VMError::report(outputStream* st, bool _verbose) {
if (_verbose) {
GCLogPrecious::print_on_error(st);
if (Universe::is_fully_initialized()) {
if (Universe::heap() != NULL) {
Universe::heap()->print_on_error(st);
st->cr();
}
if (Universe::is_fully_initialized()) {
st->print_cr("Polling page: " INTPTR_FORMAT, p2i(SafepointMechanism::get_polling_page()));
st->cr();
}