Integrated: 8367709: GenShen: Dirty cards for objects that get promoted by safepoint that intervenes between allocation and stores

William Kemper wkemper at openjdk.org
Thu Oct 16 17:52:06 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 pull request has now been integrated.

Changeset: d4472979
Author:    William Kemper <wkemper at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d4472979c43d9825ed2d008dbaed26dbf6d36180
Stats:     25 lines in 5 files changed: 11 ins; 0 del; 14 mod

8367709: GenShen: Dirty cards for objects that get promoted by safepoint that intervenes between allocation and stores

Reviewed-by: ysr

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

PR: https://git.openjdk.org/jdk/pull/27832


More information about the shenandoah-dev mailing list