RFR: 8261744: Implement CharsetDecoder ASCII and latin-1 fast-paths

Claes Redestad redestad at openjdk.java.net
Mon Feb 15 14:55:46 UTC 2021


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

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

Commit messages:
 - Safer publication of JavaLangAccess
 - Logic error
 - Move creation of JavaLangAccess up before creating System.in/out
 - Fix typo (caught by Test4625418.java)
 - Merge branch 'master' into streamdecoder
 - Let decoders use String intrinsics to inflate ASCII-only bytes
 - Remove trailing spaces
 - Add microbenchmark
 - Simplify and improve StreamDecoder/-Encoder

Changes: https://git.openjdk.java.net/jdk/pull/2574/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2574&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8261744
  Stats: 706 lines in 13 files changed: 300 ins; 107 del; 299 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2574.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2574/head:pull/2574

PR: https://git.openjdk.java.net/jdk/pull/2574


More information about the core-libs-dev mailing list