RFR: 8274242: Implement fast-path for ASCII-compatible CharsetEncoders on x86
Claes Redestad
redestad at openjdk.java.net
Fri Sep 24 16:04:08 UTC 2021
This patch extends the `ISO_8859_1.implEncodeISOArray` intrinsic on x86 to work also for ASCII encoding, which makes for example the `UTF_8$Encoder` perform on par with (or outperform) similarly getting charset encoded bytes from a String. The former took a small performance hit in JDK 9, and the latter improved greatly in the same release.
Extending the `EncodeIsoArray` intrinsics on other platforms should be possible, but I'm unfamiliar with the macro assembler in general and unlike the x86 intrinsic they don't use a simple vectorized mask to implement the latin-1 check. For example aarch64 seem to filter out the low bytes and then check if there's any bits set in the high bytes. Clever, but very different to the 0xFF80 2-byte mask that an ASCII test wants.
-------------
Commit messages:
- Freshen up CharsetEncodeDecode micro (still only tests ASCII), optimize ASCII-compatible SingleByte (e.g. ISO-8859-15)
- Add @bug id to test
- Move and adapt defunct Test6896617 test to test more Charsets without using internal APIs; remove adhoc performance tests
- Exclude encodeAsciiArray intrinsic on all non-X86 platforms
- Fix indentation
- Remove EncodeAsciiArray node and instead extend EncodeISOArray with an is_ascii predicate
- Merge MacroAssembler methods
- Implement intrinsified ASCII fast-path by copying and adapting encodeISOArray intrinsic (currently x86 only)
- Enhance UTF_8.Encoder by using StringUTF16.compress for ASCII
Changes: https://git.openjdk.java.net/jdk/pull/5621/files
Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5621&range=00
Issue: https://bugs.openjdk.java.net/browse/JDK-8274242
Stats: 763 lines in 20 files changed: 375 ins; 355 del; 33 mod
Patch: https://git.openjdk.java.net/jdk/pull/5621.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/5621/head:pull/5621
PR: https://git.openjdk.java.net/jdk/pull/5621
More information about the nio-dev
mailing list