[lworld] RFR: 8371915: [lworld] LayoutKind enum should have helper methods [v2]

Coleen Phillimore coleenp at openjdk.org
Thu Nov 20 21:01:34 UTC 2025


On Thu, 20 Nov 2025 15:12:09 GMT, Frederic Parain <fparain at openjdk.org> wrote:

>> Add some helper methods to test properties of layouts in a more reliable way.
>> 
>> Tested with Mach5, tier 1 to 3.
>> 
>> Fred
>
> Frederic Parain has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix ArrayProperties for NULLABLE_ATOMIC_FLAT

src/hotspot/share/oops/arrayKlass.cpp line 238:

> 236:   return props;
> 237: }
> 238: 

This is a good refactoring.  nit: I think the coding style has the break indented with the props = lines.

src/hotspot/share/oops/layoutKind.hpp line 85:

> 83: };
> 84: 
> 85: class LayoutKindHelper : AllStatic {

I wonder if this would be nicer if LayoutKind was a class and these helpers were in that class and encapsulate the whole thing in LayoutKind, so the accessors could be lk->is_flat(), etc?  less characters.  The enum inside LayoutKind could be referenced as LayoutKind::Kind::REFERENCE if direct references to the value is needed.  Other enum class types in the VM are used that way (like AccessFlags).  Then also it wouldn't need a helper.

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

PR Review Comment: https://git.openjdk.org/valhalla/pull/1745#discussion_r2547653899
PR Review Comment: https://git.openjdk.org/valhalla/pull/1745#discussion_r2547650140


More information about the valhalla-dev mailing list