RFR: 8343962: [REDO] Move getChars to DecimalDigits [v14]
Shaojin Wen
swen at openjdk.org
Mon Jan 20 14:32:22 UTC 2025
> This PR is a resubmission after PR #21593 was rolled back, and the unsafe offset overflow issue has been fixed.
>
> 1) Move getChars methods of StringLatin1 and StringUTF16 to DecimalDigits to reduce duplication.
>
> 2) HexDigits and OctalDigits also include getCharsLatin1 and getCharsUTF16
>
> 3) Putting these two methods into DecimalDigits can avoid the need to expose them in JavaLangAccess
> Eliminate duplicate code in BigDecimal
>
> 4) 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.
Shaojin Wen has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 29 additional commits since the last revision:
- Merge remote-tracking branch 'upstream/master' into int_get_chars_dedup_202411
- fix comments
- use putCharUnaligned
- bug fix
- from rgiulietti
- Coding style consistency, from rgiulietti
- fix benchmark, from rgiulietti
- Coding style consistency, from rgiulietti
- fix comment
- fix comment, from @rgiulietti
- ... and 19 more: https://git.openjdk.org/jdk/compare/4cf3f394...be1f88ab
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/22023/files
- new: https://git.openjdk.org/jdk/pull/22023/files/960e279e..be1f88ab
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=22023&range=13
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=22023&range=12-13
Stats: 70224 lines in 2661 files changed: 35172 ins; 22132 del; 12920 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
More information about the core-libs-dev
mailing list