Integrated: 8370503: Use String.newStringWithLatin1Bytes to simplify Integer/Long toString method

Shaojin Wen swen at openjdk.org
Fri Oct 24 16:47:16 UTC 2025


On Wed, 22 Oct 2025 06:28:34 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> With the introduction of String.newStringWithLatin1Bytes, we can use it to simplify the toString methods of Integer and Long. By replacing the implementation that supports COMPACT_STRING = false with newStringWithLatin1Bytes, we gain the following benefits:
> 1. Simplified implementation
> 2. Strings with codeSize < 35 in Integer.toString(int) and Long.toString(long) can be inlined in C1, improving performance in early calls.

This pull request has now been integrated.

Changeset: fd23a61c
Author:    Shaojin Wen <swen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/fd23a61cd48be5ae2c7f76cc88af3da5b4a27e3d
Stats:     77 lines in 2 files changed: 0 ins; 65 del; 12 mod

8370503: Use String.newStringWithLatin1Bytes to simplify Integer/Long toString method

Reviewed-by: rgiulietti, rriggs

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

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


More information about the core-libs-dev mailing list