[lworld] RFR: 8311219: [lworld] VM option "InlineFieldMaxFlatSize" cannot work well

Frederic Parain fparain at openjdk.org
Fri Jul 21 20:33:59 UTC 2023


On Fri, 21 Jul 2023 02:56:08 GMT, Jatin Bhateja <jbhateja at openjdk.org> wrote:

>> 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.

The state of Valhalla document is not a specification, but a document about the general design of the Valhalla features in the VM. Currently, fields with L-descriptors are never flattened even the final ones. There are some non-trivial problems to be solved regarding their status before initialization and until we have a good solution to those problems, the safest option is to not flattened them.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/888#discussion_r1271082739



More information about the valhalla-dev mailing list