On Mon, 27 Jul 2026 13:39:09 GMT, Tobias Hartmann <[email protected]> wrote:
> C1 eagerly allocates a buffer when loading a flat field or array element. If > the value is null and its value class is still uninitialized, this allocation > incorrectly triggers class initialization, potentially with side effects via > the static initializer that can be observed as incorrect result (good catch > by a fuzzer generated test, credits to @lepestock). See the new regression > test for more details. > > I first tried to fix this with a simple compilation bailout. However, if the > field / array only ever contains null, we'll stay in the interpreter forever, > which could lead to a performance issue if the null load/store is on the hot > path. > > So for atomic flat loads with an uninitialized value class, C1 now loads the > complete payload and checks its null marker without allocating. If null, we > just return null. If non-null, we deoptimize and re-compile once the > interpreter took care of class initialization. > > 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 been closed without being integrated. ------------- PR: https://git.openjdk.org/valhalla/pull/2670
