Integrated: 8357289: Break down the String constructor into smaller methods

Shaojin Wen swen at openjdk.org
Fri Jun 27 14:08:46 UTC 2025


On Sun, 18 May 2025 12:48:07 GMT, Shaojin Wen <swen at openjdk.org> wrote:

> Through JVM Option +PrintInlining, we found that String has a constructor codeSize of 852, which is too large. This caused failed to inline.
> 
> The following is the output information of PrintInlining:
> 
>                 @ 9   java.lang.String::<init> (12 bytes)   inline (hot)
> !m                 @ 1   java.nio.charset.Charset::defaultCharset (52 bytes)   inline (hot)
> !                  @ 8   java.lang.String::<init> (852 bytes)   failed to inline: hot method too big
> 
> 
> In Java code, the big method that cannot be inlined is the following constructor
> 
> 
> String(Charset charset, byte[] bytes, int offset, int length) {}
> 
> The above String constructor is too large; break it down into smaller methods with a codeSize under 325 to allow them to be inlined by the C2.

This pull request has now been integrated.

Changeset: 839cede1
Author:    Shaojin Wen <swen at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/839cede1a46b05d27abeaffbbd82c241910035cd
Stats:     181 lines in 1 file changed: 62 ins; 79 del; 40 mod

8357289: Break down the String constructor into smaller methods

Reviewed-by: liach, rriggs

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

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


More information about the core-libs-dev mailing list