RFR: 8360206: Refactor ReferenceProcessor::balance_queues [v2]

Sangheon Kim sangheki at openjdk.org
Thu Jun 26 06:46:28 UTC 2025


On Tue, 24 Jun 2025 07:45:15 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Simple refactoring to clean up the inner-loop conditions and control flow. Due to the structural change, the diff is slightly large and may be harder to read than the resulting code. The new version simplifies the logic by using a single `remaining_to_move` counter in the inner loop to track remaining work, and introduces early returns to reduce indentation and improve clarity.
>> 
>> Test: tier1-3
>
> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'master' into ref-refactor
>  - ref-refactor

Changes requested by sangheki (Reviewer).

src/hotspot/share/gc/shared/referenceProcessor.cpp line 652:

> 650:       if (to_len >= avg_refs) {
> 651:         // this list is full enough; move on to next
> 652:         to_idx++;

As you will keep line 647 assert, keeping '(to_idx  + 1) % _num_queues' will make safer?

-------------

PR Review: https://git.openjdk.org/jdk/pull/25930#pullrequestreview-2960832844
PR Review Comment: https://git.openjdk.org/jdk/pull/25930#discussion_r2168267653


More information about the hotspot-gc-dev mailing list