[lworld] RFR: 8311219: [lworld] VM option "InlineFieldMaxFlatSize" cannot work well
Jatin Bhateja
jbhateja at openjdk.org
Fri Jul 21 03:01:02 UTC 2023
On Fri, 21 Jul 2023 02:52:34 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
>> src/hotspot/share/classfile/fieldLayoutBuilder.cpp line 661:
>>
>>> 659: }
>>> 660: if (!too_big_to_flatten &&
>>> 661: (!(too_atomic_to_flatten | too_volatile_to_flatten) || fieldinfo.access_flags().is_final())) {
>>
>> Hi @XiaohongGong , specifications (https://openjdk.org/projects/valhalla/design-notes/state-of-valhalla/03-vm-model#flattenable-contexts) also talks about flattening final L descriptor fields of value classes.
>
> Thanks for pointing out this! I got through of the specifications just now.
>
> Final fields containing value objects, under both L and Q descriptors, can be routinely flattened. Mutable fields containing value objects under Q descriptors can be routinely flattened; mutable fields containing value objects under L descriptors must provide atomic loads and stores, which requires either atomic instructions or an indirection.
>
> Per my understanding, this means:
> 1. The final fields can be flattened for all L/Q descriptors
> 2. The non-final fields can be flattened for Q descriptors
> 3. The non-final fields cannot be flattened for L descriptor value objects due to the atomic feature.
>
>
> For value objects with many fields, the JVM may decide to fall back to buffering its value in the heap, which is the traditional indirected representation.
>
> And the above means size of the flattened fields should not exceed some value. Right?
>
> Please correct me if any misunderstanding! Thanks!
Yes, this is correct, but final fields can be flattened irrespective of sizing constraint.
-------------
PR Review Comment: https://git.openjdk.org/valhalla/pull/888#discussion_r1270179016
More information about the valhalla-dev
mailing list