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 22:27:35 UTC 2025


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.

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

Commit messages:
 - Slip of the mouse
 - Remove instrumentation
 - Merge remote-tracking branch 'jdk/master' into not-allocated-young
 - Dirty cards for newly allocated objects that are promoted during a safepoint
 - Instrumentation to track where objects are being evacuated
 - More instrumentation
 - Instrumentation for array allocs too
 - Fix instrumentation
 - Instrument slowpath allocation

Changes: https://git.openjdk.org/jdk/pull/27832/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27832&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8367709
  Stats: 25 lines in 5 files changed: 11 ins; 0 del; 14 mod
  Patch: https://git.openjdk.org/jdk/pull/27832.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27832/head:pull/27832

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


More information about the shenandoah-dev mailing list