From cf70cb70bcd5292ed10d8fb08019f0da82db25dd Mon Sep 17 00:00:00 2001 From: Thomas Schatzl Date: Thu, 21 Aug 2025 15:32:25 +0000 Subject: [PATCH] 8365024: G1: Make G1CollectionSet::_inc_build_state assert-only Reviewed-by: ayang, kbarrett --- src/hotspot/share/gc/g1/g1CollectionSet.cpp | 6 +++--- src/hotspot/share/gc/g1/g1CollectionSet.hpp | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.cpp b/src/hotspot/share/gc/g1/g1CollectionSet.cpp index 804ded144bd..6fbbeb41a82 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.cpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.cpp @@ -67,7 +67,7 @@ G1CollectionSet::G1CollectionSet(G1CollectedHeap* g1h, G1Policy* policy) : _survivor_region_length(0), _initial_old_region_length(0), _optional_groups(), - _inc_build_state(CSetBuildType::Inactive), + DEBUG_ONLY(_inc_build_state(CSetBuildType::Inactive) COMMA) _regions_inc_part_start(0), _groups_inc_part_start(0) { } @@ -142,11 +142,11 @@ void G1CollectionSet::continue_incremental_building() { _regions_inc_part_start = _regions_cur_length; _groups_inc_part_start = groups_cur_length(); - _inc_build_state = CSetBuildType::Active; + DEBUG_ONLY(_inc_build_state = CSetBuildType::Active;) } void G1CollectionSet::stop_incremental_building() { - _inc_build_state = CSetBuildType::Inactive; + DEBUG_ONLY(_inc_build_state = CSetBuildType::Inactive;) } void G1CollectionSet::clear() { diff --git a/src/hotspot/share/gc/g1/g1CollectionSet.hpp b/src/hotspot/share/gc/g1/g1CollectionSet.hpp index 2bde960fbc4..7038cd4e677 100644 --- a/src/hotspot/share/gc/g1/g1CollectionSet.hpp +++ b/src/hotspot/share/gc/g1/g1CollectionSet.hpp @@ -165,12 +165,14 @@ class G1CollectionSet { // groups. Regions are reachable via this list as well. G1CSetCandidateGroupList _optional_groups; +#ifdef ASSERT enum class CSetBuildType { Active, // We are actively building the collection set Inactive // We are not actively building the collection set }; CSetBuildType _inc_build_state; +#endif // Index into the _regions indicating the start of the current collection set increment. size_t _regions_inc_part_start; // Index into the _groups indicating the start of the current collection set increment.