@rwestrel (thanks!) noticed that flat array loads are control dependent on the flat-array layout checks, but they are not pinned strongly enough relative to the range check. New `TestFlatArrayLoadPinning.java` demonstrates this: With `-XX:+StressGCM`, C2 can schedule one of the field loads from the flat array to before the range check. When the array index is out of bounds, compiled code performs an out-of-bounds memory load from the flat array payload and crashes with a `SIGSEGV` instead of throwing the expected `ArrayIndexOutOfBoundsException`.
The fix is to use `C2_UNKNOWN_CONTROL_LOAD` for these loads. Thanks, Tobias --------- - [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). ------------- Commit messages: - JDK-8384405 Changes: https://git.openjdk.org/valhalla/pull/2445/files Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2445&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8384405 Stats: 83 lines in 2 files changed: 82 ins; 0 del; 1 mod Patch: https://git.openjdk.org/valhalla/pull/2445.diff Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2445/head:pull/2445 PR: https://git.openjdk.org/valhalla/pull/2445
