RFR: GenShen: Reference Processing Needs a Card-Marking Barrier
Y. Srinivas Ramakrishna
ysr at openjdk.org
Fri Mar 31 00:05:49 UTC 2023
On Thu, 30 Mar 2023 22:37:59 GMT, William Kemper <wkemper at openjdk.org> wrote:
>> GenShen: Reference Processing Needs a Card-Marking Barrier
>>
>> Global collections can create new cross-generational pointers during j.l..r.Reference processing which should be added to the card marking remembered set. The issue was found with dacapo during heap verification and happens somewhat rarely. I added the requisite barrier and have provided a comment describing the sole situation in reference processing that should need the barrier. Assertions check this condition, but the card is also redundantly dirtied for young collections too where it's strictly not needed.
>>
>> I have tested with and without heap verification using product and fastdebug builds using dacapo and specjbb. Will run it through our internal tests pipeline too before pushing the fix.
>>
>> I have not yet run any performance comparisons to assess the impact of the checks for applications that traffic heavily in j.l.r.Refs, but am open to any suggestions.
>>
>> Thank you for your reviews.
>
> src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp line 62:
>
>> 60: }
>> 61:
>> 62: template <typename T>
>
> This looks similar to the code we have for dropping a reference.
> https://github.com/openjdk/shenandoah/blob/2785875de3bf86ab20779c5a24ec7e0f69e452aa/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp#L397
>
> Could we use this function there?
Let me look into this a bit more closely, in regards to how the card-scanning code treats the traversal of weak pointers.
In other words, it must either be the case that the card-mark done in the code you pointed out above (in `drop`) is not needed or, if it is needed, then at least my comment (and attendant assertion at lines 81 & 82) below is wrong and needs to be suitably adjusted and retested:
Those cards will continue to
// remain dirty on account of this cross-generational pointer to the referent.
I'll update after looking into this more closely. (I'll also then see if the code can be shared like you asked.)
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/238#discussion_r1153896157
More information about the shenandoah-dev
mailing list