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

Xiaohong Gong xgong at openjdk.org
Thu Sep 7 04:03:42 UTC 2023


> Currently all the non-static final fields with inline type can be flattened, even if the layout size of the inline type is beyond
> the max flat size specified by `InlineFieldMaxFlatSize`. Please refer to the condition check [1] which decides whether a field
> can be flattened or not.
> 
> Field flattening has two major side effects: atomicity and size. Fields with atomic access limitation or large size that exceeds
> the specified threshold value cannot be flattened. And final fields are special that they are immutable after initialized. So the atomic check for them can be ignored. Hence, 1) for the atomicity free type like the primitive class, the final and non-final fields with such type can be flattened. And 2) for the normal value class that has atomic feature, only the final fields with such type can be flattened. And all kinds of the flattened fields should not exceed the specified max flat size. Please see more details from [1] [2].
> 
> The original condition [1] matches the atomicity check but not the flat size limitation. Promoting the flat size check before all other checks matches the flattening policy and can make the VM option `InlineFieldMaxFlatSize` work for final fields as well.
> 
> This patch also fixed the jtreg crashes involved after the field flattening condition is changed. Those tests fail with setting
> `-XX:+InlineFieldMaxFlatSize=0` by default. The main issue is the non-flattened inline type field is not buffered which is expected to be. The root cause is when parsing `withfield`, the compiler checks whether the field is primitive class type while not its flattening status. Changing to check the flattening status instead can fix the crash.
> 
> [1] https://github.com/openjdk/valhalla/blob/lworld/src/hotspot/share/classfile/fieldLayoutBuilder.cpp#L759
> [2] https://mail.openjdk.org/pipermail/valhalla-dev/2023-June/011262.html
> [3] https://mail.openjdk.org/pipermail/valhalla-dev/2023-July/011265.html

Xiaohong Gong has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:

 - Merge 'valhalla:lworld' into JDK-8311219
 - Fix "assert(field->type()->as_inline_klass()->is_initialized()) failed: Must be"
 - Not flatten L-descriptor value object field even it is final
 - 8311219: [lworld] VM option "InlineFieldMaxFlatSize" cannot work well

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

Changes: https://git.openjdk.org/valhalla/pull/888/files
 Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=888&range=03
  Stats: 7 lines in 4 files changed: 3 ins; 0 del; 4 mod
  Patch: https://git.openjdk.org/valhalla/pull/888.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/888/head:pull/888

PR: https://git.openjdk.org/valhalla/pull/888



More information about the valhalla-dev mailing list