[lworld] RFR: 8376221: [lworld] Do not store array of InlineLayoutInfo for all InstanceKlasses [v4]

Frederic Parain fparain at openjdk.org
Thu Jan 29 21:23:43 UTC 2026


On Thu, 29 Jan 2026 10:25:11 GMT, Paul Hübner <phubner at openjdk.org> wrote:

>> I did some local testing and we need the injected check there since the injected field is not accounted for in the count of how many fields there are in the klass, so it does not have an entry in the `_inline_layout_info_array`.
>> 
>> We could have a check like this, but I'd rather keep only having checks that return true, and returning false in the end of the function.
>> 
>> if (fieldinfo.field_flags().is_injected()) {
>>   return false;
>> }
>
> Ok, I agree I'd also prefer to return false at the end. Thanks for looking into it.

Injected fields are special fields that the VM adds to some objects for its own purpose. Accesses to these fields are hard coded in VM code and allowing flattening would increase their complexity. New code would have to handle both flat and non-flat storage, and also handle extreme situations like OOM when reading a flat fied because of heap buffering.
Because there's no visible benefits so far, and a huge cost to support flat injected fields, the current policy is to simply never flatten injected fields.
This policy can be revisited later if a pertinent use case is discovered.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1966#discussion_r2743590842


More information about the valhalla-dev mailing list