On Mon, 18 May 2026 08:37:16 GMT, Tobias Hartmann <[email protected]> wrote:

> @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).

This pull request has now been integrated.

Changeset: 381cedf0
Author:    Tobias Hartmann <[email protected]>
URL:       
https://git.openjdk.org/valhalla/commit/381cedf0544361c9c189495cfade5e16ebfe308d
Stats:     83 lines in 2 files changed: 82 ins; 0 del; 1 mod

8384405: [lworld] C2: Load nodes inserted by InlineTypeNode::make_from_flat() 
need to be pinned

Co-authored-by: Roland Westrelin <[email protected]>
Reviewed-by: roland

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

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

Reply via email to