RFR: 8303968: Serial: Use more precise liveness info in Young GC reference processing [v2]

Kim Barrett kbarrett at openjdk.org
Wed Mar 29 23:36:30 UTC 2023


On Sun, 26 Mar 2023 17:53:22 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Simple refactoring around Young-GC keep-alive-closure.
>> 
>> (I went for the static-local-var approach, as other solutions that I am aware of would expose the is-alive-closure in the header.)
>> 
>> Test: tier1-3
>
> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - review
>  - s1-ref-is-alive

Changes requested by kbarrett (Reviewer).

src/hotspot/share/gc/serial/defNewGeneration.cpp line 633:

> 631:                                           1,                        // mt discovery degree
> 632:                                           false,                    // concurrent_discovery
> 633:                                           &_is_alive_closure);

This change is not correct. The is_alive_non_header closure for Serial's
reference processor should remain nullptr (as it was before). Setting it here
does nothing but add a useless call in RP::discover_reference that will always
return false (allowing discovery to proceed).

(1) During oop iteration we encounter a young Reference, calls oop_oop_iterate_discovery
(2) oop_oop_iterate_discovery calls try_discover.
(3) try_discover examines the referent.
(3a) referent is nullptr or already marked => no discovery.
(3b) call RP::discover_reference
(4) RP::discover_reference calls the is_subject_to_discovery closure
(4a) obj is old => no discovery
(4b) obj is young => continue discovery check
(5) RP::discover_reference calls is_alive_non_header closure if it exists

The closure being provided will return true if obj is old or marked.  But
we've already filtered out both of those cases above, so the closure will
always return false, so the discovery process should proceed.

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

PR Review: https://git.openjdk.org/jdk/pull/12975#pullrequestreview-1364112845
PR Review Comment: https://git.openjdk.org/jdk/pull/12975#discussion_r1152588334


More information about the hotspot-gc-dev mailing list