This PR is a resubmission after PR #21593 was rolled back, and the unsafe 
offset overflow issue has been fixed.

Move getChars methods of StringLatin1 and StringUTF16 to DecimalDigits to 
reduce duplication

HexDigits and OctalDigits also include getCharsLatin1 and getCharsUTF16

Putting these two methods into DecimalDigits can avoid the need to expose them 
in JavaLangAccess
Eliminate duplicate code in BigDecimal

This PR will improve the performance of Integer/Long.toString and 
StringBuilder.append(int/long) scenarios. This is because Unsafe.putByte is 
used to eliminate array bounds checks, and of course this elimination is safe.

In previous versions, in Integer/Long.toString and 
StringBuilder.append(int/long) scenarios, -COMPACT_STRING performed better than 
+COMPACT_STRING. This is because StringUTF16.getChars uses StringUTF16.putChar, 
which is similar to Unsafe.putChar, and there is no bounds check.

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

Commit messages:
 - fix unsafe address overflow
 - add benchmark
 - remove comments, from @liach
 - Merge remote-tracking branch 'upstream/master' into 
int_get_chars_dedup_202410
 - fix Helper
 - fix Helper
 - fix Helper
 - unsafe putByte
 - remove digitPair
 - fix import
 - ... and 4 more: https://git.openjdk.org/jdk/compare/5890d943...cd9ba309

Changes: https://git.openjdk.org/jdk/pull/22023/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=22023&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8342650
  Stats: 757 lines in 12 files changed: 381 ins; 352 del; 24 mod
  Patch: https://git.openjdk.org/jdk/pull/22023.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22023/head:pull/22023

PR: https://git.openjdk.org/jdk/pull/22023

Reply via email to