On Fri, 21 Nov 2025 20:16:16 GMT, Coleen Phillimore <[email protected]> wrote:

>> 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.
>
> It might not be a good idea based on all the places that we read the 
> LayoutKind enum values, in which case, never mind.

I've tried to refactor as suggested, encapsulating the enum inside a class, but 
it makes a lot of code much more cumbersome than it already is when testing for 
a particular layout. I'd propose to push this refactoring as it is right now, 
and engage in some brainstorming to try to find a way to make this whole layout 
concept more natural in the code.

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

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

Reply via email to