RFR: 8367709: GenShen: Dirty cards for objects that get promoted by safepoint that intervenes between allocation and stores
William Kemper
wkemper at openjdk.org
Wed Oct 15 23:08:14 UTC 2025
On Wed, 15 Oct 2025 20:53:53 GMT, William Kemper <wkemper at openjdk.org> wrote:
> I believe this sequence of events can lead to the original assertion failing:
> 1. Shenandoah lowers the tenuring threshold to 1.
> 2. An object gets allocated on the slow path.
> 3. We come to a safepoint and run a degenerated cycle.
> 4. The object is evacuated during the degenerated cycle and has its age raised to 1.
> 5. The degenerated cycle is "upgraded" to a full GC.
> 6. The object is at the tenuring age and gets promoted by the full GC into an old region.
> 7. We leave the safepoint and the assertion fails because this "new" object is an old region.
>
> However, there is still a risk that the card marking barriers have been elided for this object. Now that the object is in the old generation we must be sure that if it ends up storing any pointers to young, then these cards must be dirtied. The solution here is conservative in that it just dirties _all_ the cards for this object. We expect this condition to be rare and the card table will refine itself on subsequent GC cycles. Also, note that we will not scan the remembered set without coming to the `init-mark` safepoint, so it will see these dirty cards.
This condition does happen pretty reliably in the `vmTestbase/vm/gc/concurrent/` family of tests mentioned in the ticket.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/27832#issuecomment-3408586943
More information about the shenandoah-dev
mailing list