RFR: 8361055: Serial: Inline SerialHeap::process_roots
Albert Mingkun Yang
ayang at openjdk.org
Mon Jun 30 09:16:40 UTC 2025
On Mon, 30 Jun 2025 08:56:04 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
>> Refactor roots processing in Serial (young-gc and full-gc) to clean up the control-flow and make is clearer what roots and closures are used in each context.
>>
>> Test: tier1-8
>
> src/hotspot/share/gc/serial/defNewGeneration.cpp line 619:
>
>> 617:
>> 618: _old_gen->scan_old_to_young_refs(_old_gen->space()->top());
>> 619: // During young-gc, visit all (strong+weak) clds with the same closure.
>
> Suggestion:
>
> _old_gen->scan_old_to_young_refs(_old_gen->space()->top());
>
> // During young-gc, visit all (strong+weak) clds with the same closure.
>
>
> I also wonder if the previous placement of `scan_old_to_young_refs` after the other roots were intentional and this PR changes that?
Both orderings are fine. (`ScavengeRootsTask` processes old-to-young pointers first). I changed that to avoid a local variable. Can revert it back if you prefers that.
> src/hotspot/share/gc/serial/serialFullGC.cpp line 492:
>
>> 490: true);
>> 491:
>> 492: ClassLoaderDataGraph::always_strong_cld_do(&follow_cld_closure);
>
> The old code treated `!ClassUnloading` differently. It's not clear to me why this change is correct.
`always_strong_cld_do` does `ClassUnloading` checking internally.
Semantically, for full-gc marking, we process always-strong clds only. (Ofc, if class unloading is off, all clds are always-strong.)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2174601186
PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2174607249
More information about the hotspot-gc-dev
mailing list