On Tue, 20 Jan 2026 13:04:15 GMT, Quan Anh Mai <[email protected]> wrote:
>> I fear I don't understand. Let's say, I have a flat array `MyValue[] arr`
>> where `MyValue` is a value class with a single field `f`. Let's also assume
>> `arr[0] == null`, `arr.field_value(0, f)` (assuming the `ci...` versions of
>> it with matching names) tries to get the constant value of the field `f` of
>> `arr[0]`, and `arr[0].f` is not null, it's rather undefined. It's not about
>> stability and folding. On the other hand, if `arr[0]` is not null, but
>> `arr[0].f` is null, `arr.field_value(0, f)` already returns `null` (the
>> `ciConstant` that means that).
>>
>> Am I missing something?
>
> That is only true from the Java perspective. From the VM perspective, a flat
> array would be something like (C++ pseudocode):
>
> class MyValuePayload {
> oop* f;
> bool null_marker;
> };
>
> MyValuePayload* arr = new MyValuePayload[n];
>
> Then, it is clear that even if `arr[0].null_marker == false`, `arr[0].f` is
> still defined and has a value (which should be `nullptr`).
As discussed offline, I'm trying change that.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/1923#discussion_r2708846928