On Fri, 18 Sep 2026 12:46:13 GMT, Stefan Karlsson <[email protected]> wrote:
>> I would call this fairly standard Hotspot code, we use this in `LogTag`, >> `MemTag`, `AdapterBlog`, `CompileCommandEnum`. I think it's standard enough >> to not be considered a pollutant, its reason for existing is clear. > > 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. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/32276#discussion_r4047693322
