RFR: 8376472: Shenandoah: Assembler store barriers read destination memory despite the decorators [v2]

Aleksey Shipilev shade at openjdk.org
Fri Jan 30 10:16:19 UTC 2026


> The issue is really a correctness issue, and it readily manifests in Valhalla, which sometimes does the stores with `IS_DEST_UNINITIALIZED` set. Unfortunately, Shenandoah SATB barriers ignore this attribute, and attempt to read the memory at store address. At best it crashes the VM with the "oopness" asserts, at worst it feeds "garbage" pointers into SATB machinery, which then wrecks havoc on everything else.
> 
> We need to make sure store barriers are consistently checking these attributes. Unfortunately, that would mean doing the changes in arch-specific assembler code. 
> 
> This PR makes sure the ShenandoahBarrierSetAssembler store barriers are roughly in the same shape, and that they consult `ShenandoahBarrierSet::need_*_barrier` to make the proper decisions whether to use SATB/card barriers.
> 
> `hotspot_gc_shenandoah` is enough to sanity-check this patch, but I am also running `all` tests for extra safety.
> 
> Additional testing:
>  - [x] Linux x86_64 server fastdebug, `hotspot_gc_shenandoah`
>  - [x] Linux AArch64 server fastdebug, `hotspot_gc_shenandoah`
>  - [x] Linux x86_64 server fastdebug, `all` + `-XX:+UseShenandoahGC`
>  - [x] Linux AArch64 server fastdebug, `all` + `-XX:+UseShenandoahGC`
>  - [x] Linux {PPC64, RISC-V, S390X} server fastdebug, cross-compilation

Aleksey Shipilev has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Missing return in PPC64 for non-reference stores
 - Merge branch 'master' into JDK-8376472-shenandoah-store-barriers
 - More polish
 - RISC-V version
 - More touchups, AArch64 version
 - Store barrier cleanup

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/29444/files
  - new: https://git.openjdk.org/jdk/pull/29444/files/f15c6cdf..327550e4

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=29444&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=29444&range=00-01

  Stats: 16541 lines in 533 files changed: 6042 ins; 3521 del; 6978 mod
  Patch: https://git.openjdk.org/jdk/pull/29444.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29444/head:pull/29444

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


More information about the hotspot-dev mailing list