8365939: [Redo] G1: Move collection set related full gc reset code into abandon_collection_set() method

Reviewed-by: ayang, iwalulya
This commit is contained in:
Thomas Schatzl 2025-08-28 09:21:52 +00:00
parent d06c66f7f5
commit 7469a274bb
3 changed files with 5 additions and 6 deletions

View File

@ -2803,6 +2803,8 @@ void G1CollectedHeap::abandon_collection_set() {
collection_set()->stop_incremental_building();
collection_set()->abandon_all_candidates();
young_regions_cset_group()->clear(true /* uninstall_group_cardset */);
}
bool G1CollectedHeap::is_old_gc_alloc_region(G1HeapRegion* hr) {

View File

@ -244,11 +244,6 @@ void G1FullCollector::complete_collection(size_t allocation_word_size) {
_heap->resize_all_tlabs();
// We clear remembered sets for young regions this late in the full GC because
// G1HeapVerifier expects the remembered sets for all young regions to be complete
// throughout most of the collection process (e.g. G1FullCollector::verify_after_marking).
_heap->young_regions_cset_group()->clear();
_heap->policy()->record_full_collection_end();
_heap->gc_epilogue(true);

View File

@ -235,6 +235,8 @@ private:
VerifyOption _vo;
bool _failures;
bool is_in_full_gc() const { return G1CollectedHeap::heap()->collector_state()->in_full_gc(); }
public:
VerifyRegionClosure(VerifyOption vo)
: _vo(vo),
@ -246,7 +248,7 @@ public:
bool do_heap_region(G1HeapRegion* r) {
guarantee(!r->has_index_in_opt_cset(), "Region %u still has opt collection set index %u", r->hrm_index(), r->index_in_opt_cset());
guarantee(!r->is_young() || r->rem_set()->is_complete(), "Remembered set for Young region %u must be complete, is %s", r->hrm_index(), r->rem_set()->get_state_str());
guarantee(is_in_full_gc() || !r->is_young() || r->rem_set()->is_complete(), "Remembered set for Young region %u must be complete outside full gc, is %s", r->hrm_index(), r->rem_set()->get_state_str());
// Humongous and old regions regions might be of any state, so can't check here.
guarantee(!r->is_free() || !r->rem_set()->is_tracked(), "Remembered set for free region %u must be untracked, is %s", r->hrm_index(), r->rem_set()->get_state_str());