RFR: 8352969: G1: Improve testability of optional collections [v10]
Guanqiang Han
ghan at openjdk.org
Thu Sep 11 14:49:55 UTC 2025
On Thu, 11 Sep 2025 12:56:53 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> 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.
>
> If the code guarded by `#ifdef` is well isolated from the actual code, I'd agree separating them improves readability. In this case, the debug code is kind of mixed with the real code (especially the one inside the for-loop), having `#ifdef` breaks the contiguity of the flow, IMO.
Hi @albertnetymk , fixed ! Please take a look.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26880#discussion_r2341234884
More information about the hotspot-gc-dev
mailing list