RFR: 8339320: Optimize ClassFile Utf8EntryImpl#inflate

Chen Liang liach at openjdk.org
Fri Aug 30 12:30:46 UTC 2024


On Thu, 29 Aug 2024 16:03:31 GMT, Chen Liang <liach at openjdk.org> wrote:

>> A very small optimization, split the large method inflate, split the infrequently used paths into a method inflateCHAR
>
> src/java.base/share/classes/jdk/internal/classfile/impl/AbstractPoolEntry.java line 402:
> 
>> 400:                 return JLA.regionMatches(s, rawBytes, LATIN1, offset, charLen);
>> 401:             } else {
>> 402:                 return JLA.regionMatches(s, chars, UTF16, 0, charLen);
> 
> I think instead of making our internal representation complex to speed up this regionMatches, we should ask the VM side if they can provide a Java API for ArraysSupport.mismatch that operates on a byte array and a char array.

Just looked at `ArraysSupport`; we don't need to ask the VM; we can already duplicate `mismatch(char[], int, char[], int, int)`, make one of its `char[]` parameter `byte[]` and proceed.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20767#discussion_r1736601972


More information about the core-libs-dev mailing list