[lworld] RFR: 8378000: [lworld] Move ArrayProperties to its own class [v4]

Joel Sikström jsikstro at openjdk.org
Thu Feb 19 17:49:21 UTC 2026


> Hello,
> 
> We should consider moving the enum ArrayProperties from ArrayKlass to its own class, ArrayProperties. In addition to making the code easier to read and understand, this allows us to have explicit setters/getters, replacing the bit-fiddling expressions that are used in many places. The ArrayProperties-specific methods in ArrayKlass have been moved to be methods in the new ArrayProperties class instead.
> 
> Perhaps the most controversial change in this PR is the removal of `ArrayKlass::ArrayProperties::DEFAULT` in favor of using a default constructor for ArrayProperties. The semantics are still the same, i.e., asking `.is_null_restricted()` or `.is_non_atomic()` will be false for the default constructed property. With this I've also removed the unused fields from ArrayProperties (DUMMY and comments).
> 
> I did consider using define macros to generate enum+getters+setters, but I opted for the stamped-out version instead.
> 
> Testing:
> * Running through tier1-2

Joel Sikström has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains seven commits:

 - Cleanups of earlier commits
 - Merge branch 'lworld' into JDK-8378000_array_properties
 - Semi-builder pattern for ArrayProperties
 - Add assert to check for invalid flags/bits
 - Change type to be consistent with compiler type
 - Braces around if-statement
 - 8378000: [lworld] Move ArrayProperties to its own class

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

Changes: https://git.openjdk.org/valhalla/pull/2114/files
  Webrev: https://webrevs.openjdk.org/?repo=valhalla&pr=2114&range=03
  Stats: 267 lines in 24 files changed: 101 ins; 52 del; 114 mod
  Patch: https://git.openjdk.org/valhalla/pull/2114.diff
  Fetch: git fetch https://git.openjdk.org/valhalla.git pull/2114/head:pull/2114

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


More information about the valhalla-dev mailing list