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.

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

Commit messages:
 - Simplify toString() implementations in Integer and Long classes\n\nReplace 
conditional COMPACT_STRINGS checks with direct calls 
to\nString.newStringWithLatin1Bytes() for better code clarity 
and\nmaintainability. This change affects:\n\n- Integer.toString(int)\n- 
Integer.toUnsignedString0(int, int)\n- Long.toString(long)\n- 
Long.toUnsignedString0(long, int)\n\nThe new approach leverages the existing 
String.newStringWithLatin1Bytes()\nmethod which already handles the 
COMPACT_STRINGS logic internally.

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

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

Reply via email to