On Tue, 19 May 2026 14:34:57 GMT, Tobias Hartmann <[email protected]> wrote:

> C1/interpreter array-access profiling is racy and can publish the exact array 
> klass before the flat/null-free flag is visible:
> https://github.com/openjdk/valhalla/blob/f87d6d1cea3b578b458075a411f7aaa5dddb2cd9/src/hotspot/share/c1/c1_LIRGenerator.cpp#L1968-L1971
> 
> C2 reads profile information lock-free and can therefore, in rare cases, 
> observe the inconsistencies reported in the JBS issue. For example, it can 
> observe profiling for an array load with an `array_type` that is knowingly 
> flat but does not have the `flat_array` property set (yet). The new 
> regression test reliably reproduces such inconsistencies for array loads and 
> stores.
> 
> Since a valid profiled flat array klass is stronger information than the flat 
> flag, the fix is to prefer that information if available. With that fix, the 
> asserts don't make much sense anymore, so I removed them.
> 
> 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: c5fafa9b
Author:    Tobias Hartmann <[email protected]>
URL:       
https://git.openjdk.org/valhalla/commit/c5fafa9b6a2ee5410f92a3681876bc17d080769e
Stats:     192 lines in 2 files changed: 176 ins; 15 del; 1 mod

8381373: [lworld] C2 failed assert(!flat || flat_array) failed: inconsistency

Reviewed-by: qamai, dlong

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

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

Reply via email to