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

Makes sense to me, thanks for investigating, this is a really tricky issue.

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

Marked as reviewed by qamai (Committer).

PR Review: 
https://git.openjdk.org/valhalla/pull/2452#pullrequestreview-4320098906

Reply via email to