> The fields declaring layout support for value classes are duplicated across 
> the FieldLayoutBuilder, InlineKlass, and ClassFileParser. I suggest that we 
> move all of these into a new class, called AvailableLayouts.
> 
> This rids us of many duplicated lines of code, and makes keeping the names 
> consistent easier (today, they are not consistent).
> 
> For the design of `AvailableLayouts`, I decided on putting the size fields 
> into an array which is indexed by casting `LayoutKind` into an `int`. This 
> saves us code bloat, both in the repo, and also in our binaries. When I've 
> looked at the generated code for the inlined callsites of 
> `InlineKlass::layout_size_in_bytes`, the switch is compiled down into table 
> dispatch. Now, we can just have it be a load from an object offset. This 
> ought to be faster as well, as no prediction needs to take place.
> 
> There's a lot of added `const` stuff in this PR as well, as issues with 
> const-correctness came up during the refactoring.
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Johan Sjölen has updated the pull request with a new target base due to a merge 
or a rebase. The pull request now contains 20 commits:

 - Merge remote-tracking branch 'origin/master' into simplify2
 - Update src/hotspot/share/oops/layoutKind.hpp
   
   Co-authored-by: Stefan Karlsson <[email protected]>
 - Support reference layout
 - Rename to NoValue
 - Self-review
 - Final?
 - S390X
 - WIP
 - another one
 - Big endian fix
 - ... and 10 more: https://git.openjdk.org/jdk/compare/3e37fa3e...51e1de30

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

Changes: https://git.openjdk.org/jdk/pull/32276/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32276&range=16
  Stats: 575 lines in 35 files changed: 138 ins; 240 del; 197 mod
  Patch: https://git.openjdk.org/jdk/pull/32276.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32276/head:pull/32276

PR: https://git.openjdk.org/jdk/pull/32276

Reply via email to