RFR: 8339158: TypeKind add slotSize field

Chen Liang liach at openjdk.org
Wed Aug 28 14:08:19 UTC 2024


On Wed, 28 Aug 2024 10:26:58 GMT, Shaojin Wen <duke at 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


More information about the core-libs-dev mailing list