From 5dee3118edd8899e01a84918ec46097c07a7e8b3 Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Tue, 9 Jun 2026 11:07:20 +0200 Subject: [PATCH] 8386247 Hi all, please review this trivial fix to rename the `G1CollectionSet::cur_length()` accessor to mirror the member name - change the old `regions_cur_length()` to something more descriptive. Testing: gha, local compilation Thanks, Thomas --- src/hotspot/share/gc/g1/g1CollectionSet.cpp | 4 ++-- src/hotspot/share/gc/g1/g1CollectionSet.hpp | 6 +++--- .../share/gc/g1/g1YoungGCAllocationFailureInjector.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index 7329e679519..802edd70a65 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -182,7 +182,7 @@ void G1CollectionSet::iterate(G1HeapRegionClosure* cl) const { void G1CollectionSet::par_iterate(G1HeapRegionClosure* cl, G1HeapRegionClaimer* hr_claimer, uint worker_id) const { - iterate_part_from(cl, hr_claimer, 0, cur_length(), worker_id); + iterate_part_from(cl, hr_claimer, 0, regions_cur_length(), worker_id); } void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const { @@ -197,7 +197,7 @@ void G1CollectionSet::iterate_optional(G1HeapRegionClosure* cl) const { void G1CollectionSet::iterate_incremental_part_from(G1HeapRegionClosure* cl, G1HeapRegionClaimer* hr_claimer, uint worker_id) const { - iterate_part_from(cl, hr_claimer, _regions_inc_part_start, regions_cur_length(), worker_id); + iterate_part_from(cl, hr_claimer, _regions_inc_part_start, regions_cur_increment_length(), worker_id); } void G1CollectionSet::iterate_part_from(G1HeapRegionClosure* cl, diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.hpp b/src/hotspot/share/gc/g1/g1CollectionSet.hpp index df0228c4956..edf9163ae62 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.hpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2026, 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 @@ -283,9 +283,9 @@ public: void iterate_incremental_part_from(G1HeapRegionClosure* cl, G1HeapRegionClaimer* hr_claimer, uint worker_id) const; // Returns the length of the current increment in number of regions. - size_t regions_cur_length() const { return _regions_cur_length - _regions_inc_part_start; } + size_t regions_cur_increment_length() const { return _regions_cur_length - _regions_inc_part_start; } // Returns the length of the whole current collection set in number of regions - size_t cur_length() const { return _regions_cur_length; } + size_t regions_cur_length() const { return _regions_cur_length; } // Iterate over the entire collection set (all increments calculated so far), applying // the given G1HeapRegionClosure on all of the regions. diff --git a/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp b/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp index 2b33a85da29..36c9916ad0f 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCAllocationFailureInjector.cpp @@ -56,7 +56,7 @@ G1YoungGCAllocationFailureInjector::G1YoungGCAllocationFailureInjector() void G1YoungGCAllocationFailureInjector::select_allocation_failure_regions() { G1CollectedHeap* g1h = G1CollectedHeap::heap(); _allocation_failure_regions.reinitialize(g1h->max_num_regions()); - SelectAllocationFailureRegionClosure closure(_allocation_failure_regions, g1h->collection_set()->cur_length()); + SelectAllocationFailureRegionClosure closure(_allocation_failure_regions, g1h->collection_set()->regions_cur_length()); g1h->collection_set_iterate_all(&closure); }