[lworld] RFR: 8376221: [lworld] Do not store array of InlineLayoutInfo for all InstanceKlasses [v5]
Frederic Parain
fparain at openjdk.org
Thu Jan 29 22:03:20 UTC 2026
On Wed, 28 Jan 2026 18:55:29 GMT, Joel Sikström <jsikstro at openjdk.org> wrote:
>> Hello,
>>
>> Please refer to the JBS issue for a more detailed description of the background of this change. In summary, I suggest we only keep the array of InlineLayoutInfo for InstanceKlasses which need it, which are Klasses that have fields that have been inlined.
>>
>> To make the transition to this easier, I suggest we change the following properties in FieldLayoutBuilder:
>>
>> _has_inline_type_fields
>> _has_flattening_information
>>
>> to
>>
>> _has_inlineable_fields
>> _has_inlined_fields
>>
>> The `_has_inlineable_fields` property is only used for printing and `_has_inlined_fields` is the property we expose out to the ClassFileParser, telling us that this class has inlined fields, so the array of InlineLayoutInfo must be "preserved" and is possible to read from. Hence, the array is now only safe to access if `InstanceKlass::has_inlined_fields` is true, or simply if the actual field being accessed is flat (`fieldDescriptor::is_flat`).
>>
>> I only found one place (in ciReplay.cpp) where we access the array of InlineLayoutInfo even though we might not have any inlined fields and only fields that are inlineable. I've changed this to use the normal "reference" path for fields that aren't flat.
>>
>> Testing:
>> * Oracle's tier1-5, hotspot_valhalla and jdk_valhalla
>
> Joel Sikström has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 11 additional commits since the last revision:
>
> - Merge branch 'lworld' into JDK-8376221_inlinelayoutinfo_array_optimization
> - LayoutKind assertion for flat fields
> - Remove mention of 'warning' in comment
> - Exception check should really be an assert
> - Move inlineable check to static helper
> - Comment for second CLEAR_PENDING_EXCEPTION
> - Clear exception before setting inline klass
> - Split assert in field sorting methods
> - IOOB assert message
> - InstanceKlass instead of Klass for set_inline_layout_info_klass
> - ... and 1 more: https://git.openjdk.org/valhalla/compare/49e22b66...b934da63
src/hotspot/share/classfile/classFileParser.cpp line 6396:
> 6394: }
> 6395:
> 6396: void ClassFileParser::set_inline_layout_info_klass(int field_index, InstanceKlass* klass, TRAPS) {
This method could take an InlineKlass* argument instead of an InstanceKlass* argument, because InlineLayoutInfo can only store information about flat value fields.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/1966#discussion_r2743734747
More information about the valhalla-dev
mailing list