RFR: 8261744: Implement CharsetDecoder ASCII and latin-1 fast-paths [v2]
Naoto Sato
naoto at openjdk.java.net
Tue Feb 16 19:53:41 UTC 2021
On Mon, 15 Feb 2021 15:19:01 GMT, Claes Redestad <redestad at openjdk.org> wrote:
>> This patch exposes a couple of intrinsics used by String to speed up ASCII checking and byte[] -> char[] inflation, which can be used by latin1 and ASCII-compatible CharsetDecoders to speed up decoding operations.
>>
>> - Fast-path implemented for all standard charsets, with up to 10x performance improvements in microbenchmarks reading Strings from ByteArrayInputStream.
>> - Cleanup of StreamDecoder/-Encoder with some minor improvements when interpreting
>> - Reworked creation of JavaLangAccess to be safely published for CharsetDecoders/-Encoders used for setting up System.out/in. As JLA and these encoders are created during System.initPhase1 the current sequence caused the initialization to became unstable and a few tests were consistently getting an NPE.
>>
>> Testing: tier1-3
>
> Claes Redestad has updated the pull request incrementally with one additional commit since the last revision:
>
> Revert rem assertions
Great improvement! Looks good to me overall. I wondered about the changes in JLA as Alan already mentioned.
src/java.base/share/classes/java/lang/String.java line 1017:
> 1015: * @return the number of bytes successfully decoded, at most len
> 1016: */
> 1017: /* package-private */
Some more explanation would be helpful here, as it is accessed from System for shared secrets.
src/java.base/share/classes/jdk/internal/access/JavaLangAccess.java line 48:
> 46: import jdk.internal.module.ServicesCatalog;
> 47: import jdk.internal.reflect.ConstantPool;
> 48: import jdk.internal.vm.annotation.IntrinsicCandidate;
Not needed.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2574
More information about the core-libs-dev
mailing list