RFR: 8303968: Serial: Use more precise liveness info in Young GC reference processing [v2]
Albert Mingkun Yang
ayang at openjdk.org
Thu Mar 30 10:29:18 UTC 2023
On Wed, 29 Mar 2023 23:33:13 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>>
>> - review
>> - s1-ref-is-alive
>
> 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.
`is_subject_to_discovery` checks on the reference, while `is_alive_non_header` checks on the referent.
Without this change to ref-processor, the newly added assert in `KeepAliveClosure` (part of this PR) would fail.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/12975#discussion_r1153055936
More information about the hotspot-gc-dev
mailing list