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 22:38:16 UTC 2025


On Mon, 8 Dec 2025 21:25:46 GMT, Xiaolong Peng <xpeng at openjdk.org> wrote:

>> 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 doing 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 weird and will confuse people when will read the code in the further.

I have removed the asserts, given that it is not possible the guarantee that the assert will always pass, also I think we shall not verify the behavior of ShenandoahCardBarrier in the ShenandoahSATBBarrier code.

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

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


More information about the shenandoah-dev mailing list