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

Chen Liang liach at openjdk.org
Thu May 9 21:19:09 UTC 2024


On Thu, 9 May 2024 21:15:31 GMT, Chen Liang <liach at openjdk.org> wrote:

>> A peek into TypeKind during the research for #19105 reveals that TypeKind has a few issues:
>> 1. Name mismatch for `newarraycode` and `fromNewArrayCode`: Renamed both to use "newarray code"
>> 2. `fromDescriptor` can throw IOOBE if the input string is empty: changed to throw IAE and added tests.
>> 3. `from(Class)` can be slow due to descriptor computation: added benchmark, will share result in next comment (as it may change with code changes).
>> 
>> The first 2 changes involves API changes, and a CSR has been created. Requesting @asotona for a review.
>
> Chen Liang has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Restore fixed seed
>  - Revert "Hash table, use fixed random seed"
>    
>    This reverts commit 9af30c65d2c7be3535e4483e278151bc4473d63c.

I have reverted the hash table as discussed. Can you both review this version again?
`TypeKind.from` shouldn't be too much of a bottleneck in ClassFile building, as it's mostly just used for local variable loading; we can just stay with this proven optimization for non-primitives and revisit later if profiling reveals this is a bottleneck.

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

PR Comment: https://git.openjdk.org/jdk/pull/19109#issuecomment-2103432789


More information about the core-libs-dev mailing list