RFR: 8331744: java.lang.classfile.TypeKind improvements [v4]

Adam Sotona asotona at openjdk.org
Thu May 9 12:31:54 UTC 2024


On Thu, 9 May 2024 12:07:22 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/classfile/TypeKind.java line 139:
>> 
>>> 137:             case 'V' -> TypeKind.VoidType;
>>> 138:             default -> throw new IllegalArgumentException("Bad type: " + s);
>>> 139:         };
>> 
>> This maps to a `tableswitch`, could you explain why a statically initialized array addressed with a custom hash code suppose to be faster?
>> Thanks.
>
> I actually am not sure of the reason; it is indeed a tableswitch in bytecode. @cl4es might know it better?

Generally I agree with the API changes and with the `descriptor.isPrimitive()` test before requesting a descriptor string.
However I'm missing the point of the other changes, which only replace this single `tableswitch` with something way more complicated, without clear performance gain.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19109#discussion_r1595381124


More information about the core-libs-dev mailing list