RFR: 8358334: C2/Shenandoah: incorrect execution with Unsafe

Roland Westrelin roland at openjdk.org
Tue Jun 10 14:20:14 UTC 2025


When a barrier is expanded, some control is picked as a location for
the barrier. The control input of data nodes that depend on that
control are updated so the nodes are after the expanded barrier unless
the barrier itself depends on some of those nodes.

In this particular failure, a raw memoy `Store` is the input memory to
the barrier. That `Store` has an anti-dependent `Load`. All 3 nodes
(barrier, `Load` and `Store`) are at the same control. The `Store` is
an input to the barrier so it stays before the barrier. The `Load`'s
control is updated to be after the barrier which breaks the
anti-dependency. The bug is that the logic that sorts nodes that need
to be before the barrier and those that can be after ignores
anti-dependencies. The fix simply extends that logic to take them into
account.

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

Commit messages:
 - whitespaces
 - fix & test

Changes: https://git.openjdk.org/jdk/pull/25729/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25729&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8358334
  Stats: 153 lines in 3 files changed: 117 ins; 26 del; 10 mod
  Patch: https://git.openjdk.org/jdk/pull/25729.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25729/head:pull/25729

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


More information about the shenandoah-dev mailing list