On Wed, 28 Aug 2024 10:26:58 GMT, Shaojin Wen <d...@openjdk.org> wrote:
> Small improvement, add a final field, no need to calculate every time. What if we reorder the constants to be like: VOID, REFERENCE, DOUBLE, LONG, FLOAT, INT, SHORT, CHAR, BYTE, BOOLEAN; and check like: int i = ordinal(); return i < 3 ? i : i == 3 : 2 : 1; I think about such an order because we usually switch over: 1. `VOID, REFERENCE, DOUBLE, LONG, FLOAT, INT` for "computational types" 2. `DOUBLE, LONG, FLOAT, INT, SHORT, CHAR, BYTE, BOOLEAN` for array instructions and such This order might reduce table switch size for both cases. ------------- PR Comment: https://git.openjdk.org/jdk/pull/20743#issuecomment-2315419446