8264818: G1: Improve liveness check for empty pinned regions after full gc marking

Reviewed-by: sjohanss, ayang, mli
This commit is contained in:
Thomas Schatzl 2021-04-15 08:44:52 +00:00
parent 75da1e9a64
commit bba16f61bb

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -54,7 +54,7 @@ bool G1FullGCPrepareTask::G1CalculatePointersClosure::do_heap_region(HeapRegion*
free_humongous_region(hr); free_humongous_region(hr);
} }
} else if (hr->is_open_archive()) { } else if (hr->is_open_archive()) {
bool is_empty = _bitmap->get_next_marked_addr(hr->bottom(), hr->top()) >= hr->top(); bool is_empty = _collector->live_words(hr->hrm_index()) == 0;
if (is_empty) { if (is_empty) {
free_open_archive_region(hr); free_open_archive_region(hr);
} }
@ -62,10 +62,10 @@ bool G1FullGCPrepareTask::G1CalculatePointersClosure::do_heap_region(HeapRegion*
// nothing to do with closed archive region // nothing to do with closed archive region
} else { } else {
assert(MarkSweepDeadRatio > 0, assert(MarkSweepDeadRatio > 0,
"it should not trigger skipping compaction, when MarkSweepDeadRatio == 0"); "only skip compaction for other regions when MarkSweepDeadRatio > 0");
// Force the high live ration region pinned, // Force the high live ratio region as compacting to skip these regions in the
// as we need skip these regions in the later compact step. // later compaction step.
force_not_compacted = true; force_not_compacted = true;
log_debug(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT, log_debug(gc, phases)("Phase 2: skip compaction region index: %u, live words: " SIZE_FORMAT,
hr->hrm_index(), _collector->live_words(hr->hrm_index())); hr->hrm_index(), _collector->live_words(hr->hrm_index()));