From fa33d856bf1315d358169f339e1f7a42bca3717f Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Fri, 12 Jun 2026 10:39:32 +0200 Subject: [PATCH] * region_count -> regions_count --- src/hotspot/share/gc/g1/g1CollectionSet.cpp | 36 +++++++++---------- src/hotspot/share/gc/g1/g1CollectionSet.hpp | 26 +++++++------- .../share/gc/g1/g1ParScanThreadState.cpp | 6 ++-- src/hotspot/share/gc/g1/g1Policy.cpp | 10 +++--- src/hotspot/share/gc/g1/g1YoungCollector.cpp | 2 +- .../gc/g1/g1YoungGCPostEvacuateTasks.cpp | 6 ++-- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index 93d3557329e..5fd65f67b24 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -62,9 +62,9 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) : _max_regions(0), _num_regions(0), _groups(), - _eden_region_count(0), - _survivor_region_count(0), - _initial_old_region_count(0), + _eden_regions_count(0), + _survivor_regions_count(0), + _initial_old_regions_count(0), _optional_groups(), DEBUG_ONLY(_inc_build_state(CSetBuildType::Inactive) COMMA) _regions_inc_part_start(0), @@ -76,17 +76,17 @@ G1CollectionSet::~G1CollectionSet() { abandon_all_candidates(); } -void G1CollectionSet::init_region_counts(uint eden_cset_region_count, - uint survivor_cset_region_count) { +void G1CollectionSet::init_regions_counts(uint eden_cset_regions_count, + uint survivor_cset_regions_count) { assert_at_safepoint_on_vm_thread(); - _eden_region_count = eden_cset_region_count; - _survivor_region_count = survivor_cset_region_count; + _eden_regions_count = eden_cset_regions_count; + _survivor_regions_count = survivor_cset_regions_count; - assert(young_region_count() == num_regions(), - "Young region count %u should match collection set region count %u", young_region_count(), num_regions()); + assert(young_regions_count() == num_regions(), + "Young region count %u should match collection set region count %u", young_regions_count(), num_regions()); - _initial_old_region_count = 0; + _initial_old_regions_count = 0; assert(_optional_groups.length() == 0, "Should not have any optional groups yet"); _optional_groups.clear(); } @@ -109,7 +109,7 @@ void G1CollectionSet::abandon() { void G1CollectionSet::abandon_all_candidates() { _candidates.clear(); - _initial_old_region_count = 0; + _initial_old_regions_count = 0; } void G1CollectionSet::prepare_for_scan () { @@ -130,7 +130,7 @@ void G1CollectionSet::add_old_region(G1HeapRegion* hr) { assert(num_regions() < _max_regions, "Collection set now larger than maximum size."); _regions[_num_regions++] = hr->hrm_index(); - _initial_old_region_count++; + _initial_old_regions_count++; _g1h->old_set_remove(hr); } @@ -335,9 +335,9 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi // pause are appended to the RHS of the young list, i.e. // [Newly Young Regions ++ Survivors from last pause]. - uint eden_region_count = _g1h->eden_regions_count(); - uint survivor_region_count = survivors->length(); - init_region_counts(eden_region_count, survivor_region_count); + uint eden_regions_count = _g1h->eden_regions_count(); + uint survivor_regions_count = survivors->length(); + init_regions_counts(eden_regions_count, survivor_regions_count); verify_young_cset_indices(); @@ -345,13 +345,13 @@ double G1CollectionSet::finalize_young_part(double target_pause_time_ms, G1Survi double predicted_base_time_ms = _policy->predict_base_time_ms(pending_cards, card_rs_length); // Base time already includes the whole remembered set related time, so do not add that here // again. - double predicted_eden_time = _policy->predict_young_region_other_time_ms(eden_region_count) + - _policy->predict_eden_copy_time_ms(eden_region_count); + double predicted_eden_time = _policy->predict_young_region_other_time_ms(eden_regions_count) + + _policy->predict_eden_copy_time_ms(eden_regions_count); double remaining_time_ms = MAX2(target_pause_time_ms - (predicted_base_time_ms + predicted_eden_time), 0.0); log_trace(gc, ergo, cset)("Added young regions to CSet. Eden: %u regions, Survivors: %u regions, " "predicted eden time: %1.2fms, predicted base time: %1.2fms, target pause time: %1.2fms, remaining time: %1.2fms", - eden_region_count, survivor_region_count, + eden_regions_count, survivor_regions_count, predicted_eden_time, predicted_base_time_ms, target_pause_time_ms, remaining_time_ms); // Clear the fields that point to the survivor list - they are all young now. diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.hpp b/src/hotspot/share/gc/g1/g1CollectionSet.hpp index c6839d00168..29b50fdb09b 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.hpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.hpp @@ -156,9 +156,9 @@ class G1CollectionSet { uint num_groups() const; - uint _eden_region_count; - uint _survivor_region_count; - uint _initial_old_region_count; + uint _eden_regions_count; + uint _survivor_regions_count; + uint _initial_old_regions_count; // When doing mixed collections we can add old regions to the collection set, which // will be collected only if there is enough time. We call these optional (old) @@ -245,21 +245,21 @@ public: void prepare_for_scan(); - void init_region_counts(uint eden_cset_region_count, - uint survivor_cset_region_count); + void init_regions_counts(uint eden_cset_regions_count, + uint survivor_cset_regions_count); // Total number of regions in the initial collection set. - uint initial_region_count() const { return young_region_count() + - initial_old_region_count(); } - uint young_region_count() const { return eden_region_count() + - survivor_region_count(); } + uint initial_regions_count() const { return young_regions_count() + + initial_old_regions_count(); } + uint young_regions_count() const { return eden_regions_count() + + survivor_regions_count(); } - uint eden_region_count() const { return _eden_region_count; } - uint survivor_region_count() const { return _survivor_region_count; } - uint initial_old_region_count() const { return _initial_old_region_count; } + uint eden_regions_count() const { return _eden_regions_count; } + uint survivor_regions_count() const { return _survivor_regions_count; } + uint initial_old_regions_count() const { return _initial_old_regions_count; } uint num_optional_regions() const { return _optional_groups.num_regions(); } - bool only_contains_young_regions() const { return (initial_old_region_count() + num_optional_regions()) == 0; } + bool only_contains_young_regions() const { return (initial_old_regions_count() + num_optional_regions()) == 0; } template inline void merge_cardsets_for_collection_groups(CardOrRangeVisitor& cl, uint worker_id, uint num_workers); diff --git a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp index d85e784d739..a13bb615164 100644 --- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp +++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp @@ -76,7 +76,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, _trim_ticks(), _surviving_young_words_base(nullptr), _surviving_young_words(nullptr), - _surviving_words_length(collection_set->young_region_count() + 1), + _surviving_words_length(collection_set->young_regions_count() + 1), _old_gen_is_full(false), _partial_array_splitter(g1h->partial_array_state_manager(), num_workers), _string_dedup_requests(), @@ -717,7 +717,7 @@ G1ParScanThreadStateSet::G1ParScanThreadStateSet(G1CollectedHeap* g1h, _g1h(g1h), _collection_set(collection_set), _states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, num_workers, mtGC)), - _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, collection_set->young_region_count() + 1, mtGC)), + _surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, collection_set->young_regions_count() + 1, mtGC)), _num_workers(num_workers), _flushed(false), _evac_failure_regions(evac_failure_regions) @@ -725,7 +725,7 @@ G1ParScanThreadStateSet::G1ParScanThreadStateSet(G1CollectedHeap* g1h, for (uint i = 0; i < num_workers; ++i) { _states[i] = nullptr; } - memset(_surviving_young_words_total, 0, (collection_set->young_region_count() + 1) * sizeof(size_t)); + memset(_surviving_young_words_total, 0, (collection_set->young_regions_count() + 1) * sizeof(size_t)); } G1ParScanThreadStateSet::~G1ParScanThreadStateSet() { diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp index 843710ff46d..023b17849e7 100644 --- a/src/hotspot/share/gc/g1/g1Policy.cpp +++ b/src/hotspot/share/gc/g1/g1Policy.cpp @@ -855,7 +855,7 @@ G1CollectorState G1Policy::record_young_collection_end(bool concurrent_operation // given that humongous object allocations do not really affect // either the pause's duration nor when the next pause will take // place we can safely ignore them here. - uint regions_allocated = _collection_set->eden_region_count(); + uint regions_allocated = _collection_set->eden_regions_count(); double alloc_rate_ms = (double) regions_allocated / app_time_ms; _analytics->report_alloc_rate_ms(alloc_rate_ms); @@ -919,14 +919,14 @@ G1CollectorState G1Policy::record_young_collection_end(bool concurrent_operation _analytics->report_cost_per_byte_ms(cost_per_byte_ms, is_young_only_pause); } - if (_collection_set->young_region_count() > 0) { + if (_collection_set->young_regions_count() > 0) { _analytics->report_young_other_cost_per_region_ms(young_other_time_ms() / - _collection_set->young_region_count()); + _collection_set->young_regions_count()); } - if (_collection_set->initial_old_region_count() > 0) { + if (_collection_set->initial_old_regions_count() > 0) { _analytics->report_non_young_other_cost_per_region_ms(non_young_other_time_ms() / - _collection_set->initial_old_region_count()); + _collection_set->initial_old_regions_count()); } _analytics->report_constant_other_time_ms(constant_other_time_ms(pause_time_ms)); diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index 5ff3543c85d..41fbe3f780c 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.cpp @@ -260,7 +260,7 @@ void G1YoungCollector::calculate_collection_set(G1EvacInfo* evacuation_info, dou allocator()->release_mutator_alloc_regions(); collection_set()->finalize_initial_collection_set(target_pause_time_ms, survivor_regions()); - evacuation_info->set_collection_set_regions(collection_set()->initial_region_count() + + evacuation_info->set_collection_set_regions(collection_set()->initial_regions_count() + collection_set()->num_optional_regions()); concurrent_mark()->verify_no_collection_set_oops(); diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index a4ef7fd6f04..5e6bfe45a7c 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -649,9 +649,9 @@ class FreeCSetClosure : public G1HeapRegionClosure { void assert_tracks_surviving_words(G1HeapRegion* r) { assert(r->young_index_in_cset() != 0 && - (uint)r->young_index_in_cset() <= _g1h->collection_set()->young_region_count(), + (uint)r->young_index_in_cset() <= _g1h->collection_set()->young_regions_count(), "Young index %u is wrong for region %u of type %s with %u young regions", - r->young_index_in_cset(), r->hrm_index(), r->get_type_str(), _g1h->collection_set()->young_region_count()); + r->young_index_in_cset(), r->hrm_index(), r->get_type_str(), _g1h->collection_set()->young_regions_count()); } void handle_evacuated_region(G1HeapRegion* r) { @@ -810,7 +810,7 @@ public: p->record_serial_free_cset_time_ms((Ticks::now() - serial_time).seconds() * 1000.0); } - double worker_cost() const override { return G1CollectedHeap::heap()->collection_set()->initial_region_count(); } + double worker_cost() const override { return G1CollectedHeap::heap()->collection_set()->initial_regions_count(); } void set_max_workers(uint max_workers) override { _active_workers = max_workers;