RFR: 8376531: Genshen: Missing volatile modifier on multiple fields of ShenandoahOldGeneration

Xiaolong Peng xpeng at openjdk.org
Tue Jan 27 22:29:22 UTC 2026


Came across the source code of ShenandoahOldGeneration, and noticed that we use AtomicAccess to read/write to fields `_promoted_expended`, `_promotion_failure_count`, `_promotion_failure_words` but non of them is declared with volatile modifier.

Given that OpenJDK has introduced `Atomic<T>` to replace the idiom of volatile var plus AtomicAccess:: operations(see details [here](https://bugs.openjdk.org/browse/JDK-8367013), I decided to convert these fields to `Atomic<T>` instead of adding `volatile`.

### Test
- [x] hotshpot_gc_shenandoah
- [ ] GHA

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

Commit messages:
 - Merge branch 'openjdk:master' into JDK-8376531
 - 8376531: Genshen: Missing volatile modifier on multiple fields of ShenandoahOldGeneration

Changes: https://git.openjdk.org/jdk/pull/29456/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29456&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8376531
  Stats: 16 lines in 2 files changed: 0 ins; 0 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/29456.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29456/head:pull/29456

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


More information about the hotspot-gc-dev mailing list