[lworld] RFR: 8359345: [lworld] C2 crashes with -XX:ForceNonTearable=* [v2]

Tobias Hartmann thartmann at openjdk.org
Tue Jul 1 10:21:02 UTC 2025


> For test method `testFieldLoad1` the graph looks like this after parsing:
> ![Screenshot from 2025-06-30 13-42-44](https://github.com/user-attachments/assets/94726f40-8260-47ab-86e1-a47b074a6929)
> 
> Now since [JDK-8354068](https://bugs.openjdk.org/browse/JDK-8354068) `MemNode::optimize_simple_memory_chain` rewires the memory input of strict field load `46 LoadL` to before the membar:
> ![Screenshot from 2025-06-30 15-06-13](https://github.com/user-attachments/assets/b8ac826e-1426-4212-8567-0aa1c8da5ad9)
> 
> Later in `PhaseCFG::insert_anti_dependences`, a precedence edge from the membar to the load (now named `15 LoadL`) is added, because the type of the `CastI2N` is `TypeNarrowOop::BOTTOM` and thus `AliasType::is_rewritable` is true (it should be false). The resulting graph is unschedulable:
> ![Screenshot from 2025-06-30 13-37-59](https://github.com/user-attachments/assets/ea1e5361-8863-4ebc-b733-155bc53bce72)
> 
> [JDK-8354981](https://bugs.openjdk.org/browse/JDK-8354981) added these `MemBarCPUOrders` around flat, atomic stores and then [JDK-8357474](https://bugs.openjdk.org/browse/JDK-8357474) also added them around loads. The same problem exists for `MemBarCPUOrders` emitted by stores. The memory input of following loads will be wired around them and an anti-dependency will be added.
> 
> The fix is to change `CastI2NNode` to a `TypeNode` that carries the exact type. This ways we can also avoid the `CastPPNode` after the decode.
> 
> Thanks,
> Tobias

Tobias Hartmann has updated the pull request incrementally with one additional commit since the last revision:

  New fix

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

Changes:
  - all: https://git.openjdk.org/valhalla/pull/1494/files
  - new: https://git.openjdk.org/valhalla/pull/1494/files/a7948605..d64bc05c

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

  Stats: 12 lines in 3 files changed: 3 ins; 6 del; 3 mod
  Patch: https://git.openjdk.org/valhalla/pull/1494.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/1494/head:pull/1494

PR: https://git.openjdk.org/valhalla/pull/1494


More information about the valhalla-dev mailing list