JDK-8371915 : [lworld] LayoutKind enum should have helper methods
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: repo-valhalla
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2025-11-14
  • Updated: 2025-11-24
  • Resolved: 2025-11-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
repo-valhallaFixed
Related Reports
Relates :  
Description
The LayoutKind enum provides a simple encoding of the layout used for the flat representation of a value, but code often needs to know the properties of a particular layout.
For instance, here's how some code tests if a flat field has some atomicity requirement:

bool is_atomic = layout != LayoutKind::NON_ATOMIC_FLAT;

This code is brittle because it might need to be updated each time a new layout is added to the LayoutKind enum.

To prevent this situation, a LayoutKindHelper class should be created to unify the way layout properties are tested. This class should provide methods like LayoutKindHelper::is_atomic(LayoutKind lk), LayoutKindHelper::is_nullable(LayoutKind lk), etc.

This helper class could also provide a method to perform the LayoutKind -> ArrayProperties mapping, which is currently implemented in three different places in the VM.

Comments
A pull request was submitted for review. Branch: lworld URL: https://git.openjdk.org/valhalla/pull/1745 Date: 2025-11-18 18:19:00 +0000
18-11-2025