RFR: 8352969: G1: Improve testability of optional collections [v10]
Guanqiang Han
ghan at openjdk.org
Thu Sep 11 12:34:19 UTC 2025
On Thu, 11 Sep 2025 11:19:51 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update TestOptionalRegionGC.java
>>
>> Correct the formatting errors
>
> src/hotspot/share/gc/g1/g1CollectionSet.cpp line 417:
>
>> 415: G1CSetCandidateGroupList* from_marking_groups = &candidates()->from_marking_groups();
>> 416:
>> 417: #ifdef ASSERT
>
> I'd suggest removing `#ifdef ASSERT`; the compiler should be able to remove unreachable code in an optimized build.
Hi @albertnetymk , thanks for the suggestion! While the compiler may indeed optimize away unreachable branches,
keeping the `#ifdef ASSERT` here makes it clear that this block is intended for development/debugging
and also helps with readability and maintainability for future reviewers.
I’m happy to adjust if there’s a preferred convention you’d like me to follow.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26880#discussion_r2340608619
More information about the hotspot-gc-dev
mailing list