On Fri, 18 Sep 2026 14:36:05 GMT, Johan Sjölen <[email protected]> wrote:

>> There are many unclean parts of HotSpot that could make do with a cleanup.
>> 
>> This is classical type-smooshing that leads to code that is a tiny bit 
>> harder to reason about. Maybe this is easy enough to understand here, but it 
>> is unnecessary, IMHO. All code that now takes a LayoutKind could previously 
>> assume that the passed in value was one of the valid "layout kinds". That is 
>> lost with this change. Now we have to at least briefly consider that someone 
>> might be passing in COUNT. I think that is unfortunate, and it is something 
>> that can easily be fixed by using a separate integer constant.
>> 
>> Note, this is only needed for iterating over the values. That can be handled 
>> with the ENUMARATOR_RANGE / ENUMERATOR_VALUE_RANGE and EnumRange.
>
> It is also necessary for determining the size of the array for storing the 
> LayoutKinds. If we are to consider this pattern unclean, then it should be 
> cleaned up as a whole in a separate RFE, as for this PR I'll consider it a 
> bona fide pattern.

The array size also doesn't take a LayoutKind, it takes a size argument and the 
code has to make a cast to support that. It would be very small change to this 
patch to move the COUNT out of the LayoutKind.

I'm not blocking this PR over this, but I am curious about the the motivation 
for rejecting that proposal? Are you arguing that this is a better design, or 
is the argument that this PR has already taken a long time to be reviewed?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32276#discussion_r4060249813

Reply via email to