RFR: 8361055: Serial: Inline SerialHeap::process_roots [v2]
Thomas Schatzl
tschatzl at openjdk.org
Tue Jul 8 08:30:40 UTC 2025
On Fri, 4 Jul 2025 11:58:28 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> src/hotspot/share/gc/serial/defNewGeneration.cpp line 627:
>>
>>> 625: ScavengableNMethods::nmethods_do(&nmethod_cl);
>>> 626:
>>> 627: OopStorageSet::strong_oops_do(&oop_cl);
>>
>> Suggestion:
>>
>> // During young-gc, visit all (strong+weak) clds with the same closure.
>> ClassLoaderDataGraph::cld_do(&cld_cl);
>>
>> Threads::oops_do(&oop_cl, &nmethod_cl);
>>
>> OopStorageSet::strong_oops_do(&oop_cl);
>>
>> ScavengableNMethods::nmethods_do(&nmethod_cl);
>>
>>
>> Keep same order of CLDG, Thread roots and OopStorage iteration to keep comparability high.
>
> It's kind of intentional that `Threads::oops_do(&oop_cl, &nmethod_cl);` and `ScavengableNMethods::nmethods_do(&nmethod_cl);` are next to each other. This way, it becomes more obvious that `Threads::oops_do` don't need to visit nmethod, i.e. nmethod_cl can be null there.
The most obvious thing to me would be explicitly spelling it out instead of assuming some reader's intuition, but I see your point.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2191835737
More information about the hotspot-gc-dev
mailing list