RFR: 8361055: Serial: Inline SerialHeap::process_roots [v2]

Thomas Schatzl tschatzl at openjdk.org
Fri Jul 4 11:27:44 UTC 2025


On Mon, 30 Jun 2025 10:30:21 GMT, Albert Mingkun Yang <ayang 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
>
> Albert Mingkun Yang has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review

I still do not see that much advantage of the new code over the other but I am not blocking this.

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.

src/hotspot/share/gc/serial/serialFullGC.cpp line 731:

> 729: 
> 730:     NMethodToOopClosure nmthod_cl(&adjust_pointer_closure, NMethodToOopClosure::FixRelocations);
> 731:     CodeCache::nmethods_do(&nmthod_cl);

Suggestion:

    NMethodToOopClosure nmethod_cl(&adjust_pointer_closure, NMethodToOopClosure::FixRelocations);
    CodeCache::nmethods_do(&nmethod_cl);

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

PR Review: https://git.openjdk.org/jdk/pull/26038#pullrequestreview-2986717548
PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2185087687
PR Review Comment: https://git.openjdk.org/jdk/pull/26038#discussion_r2185084434


More information about the hotspot-gc-dev mailing list