RFR: 8373116: Genshen: arraycopy_work should be always done for arrays in old gen during young concurrent marking [v7]

Xiaolong Peng xpeng at openjdk.org
Mon Dec 8 21:30:00 UTC 2025


On Mon, 8 Dec 2025 20:52:54 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> Xiaolong Peng has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Also test is_generational
>
> src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.inline.hpp line 464:
> 
>> 462:             assert(!_heap->is_in_young(obj) ||
>> 463:                    card_scan->is_card_dirty(elem_heap_word_ptr) ||
>> 464:                    card_scan->is_write_card_dirty(elem_heap_word_ptr),
> 
> I believe there is a very slight risk of assertion failure here, which might be so rare that you could just mention the possibility in the "error message" or in a comment associated with this code.
> 
> The race is that some other thread could overwrite an an old-gen array element with pointer to young during young marking, and we might see this interesting young pointer before that other thread has had a chance to mark the associated card dirty.

Yes, it is still possible to fail because during arraycopy, there could be mutators updating objects in the array or also  do arraycopy, they will update the write card at the same time. 

With the better understanding of ShenandoahSATBBarrier and ShenandoahCardBarrier after the discussions, I don't think it make sense to add the these asserts. We are verifying the behavior of ShenandoahCardBarrier in the ShenandoahSATBBarrier code, which is wired and will confuse people when will read the code in the further.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28669#discussion_r2600191941


More information about the shenandoah-dev mailing list