RFR: 8284734: Undiscovered references if using ReferentBasedDiscovery
Kim Barrett
kbarrett at openjdk.java.net
Mon Apr 18 10:18:42 UTC 2022
On Mon, 18 Apr 2022 09:02:07 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Small change of fixing a crash if using `ReferentBasedDiscovery`.
>>
>> Test: hotspot_gc
>
> src/hotspot/share/gc/shared/referenceProcessor.cpp line 1008:
>
>> 1006: // 2. CM restarts after mark-stack overflow.
>> 1007: assert(UseG1GC, "inv");
>> 1008: return true;
>
> This whole block that is checking discovered is, for non-G1 is really just an assert that discovered is nullptr. It would be better to entirely avoid the fetch of discovered here for other collectors in non-debug builds. Maybe this block ought to instead be something like
>
> if (UseG1GC) {
> // G1 might process (and so attempt to discover) a reference multiple
> // times, due to CM restart after mark-stack overflow.
> const oop discovered = ...;
> if (discovered != nullptr) {
> assert(oopDesc::is_oop(discovered), ...);
> return true;
> }
> } else {
> assert(java_lang_ref_Reference::discovered(obj) == nullptr, ...);
> }
Can the UseG1GC test instead be discovery_is_concurrent()? The old comments talk about concurrent discovery. But can a G1 young-only collection during a concurrent cycle attempt to discover a reference that is already in the CM reference processor? I'm not sure, and the discovery policy might be relevant to the answer.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8196
More information about the hotspot-gc-dev
mailing list