RFR: 8361055: Serial: Inline SerialHeap::process_roots

Stefan Karlsson stefank at openjdk.org
Mon Jun 30 09:50:40 UTC 2025


On Mon, 30 Jun 2025 09:10:55 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> 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.

OK. I understand. It could be worth adding a comment explaining that we're scanning objects that were old before relocation started. FWIW, if you want to keep it at the top then I think you can get rid of "_old_gen->space()->top()" from this function and extract it inside scan_old_to_young_refs instead.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2174674549


More information about the hotspot-gc-dev mailing list