C2 inlining failed because the String constructor is too large
Remi Forax
forax at univ-mlv.fr
Sun May 18 19:29:47 UTC 2025
It's perhaps easier to just add an annotation @ForceInlining.
regards,
Rémi
> From: "wenshao" <shaojin.wensj at alibaba-inc.com>
> To: "core-libs-dev" <core-libs-dev at openjdk.org>
> Sent: Sunday, May 18, 2025 5:51:15 PM
> Subject: C2 inlining failed because the String constructor is too large
> 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
> ```java
> String(Charset charset, byte[] bytes, int offset, int length) {}
> ```
> This is an important method that is called frequently. Breaking it into small
> methods does not require changing the code logic and is easy to accomplish.
> It is the easiest gain with minimal impact. I suggest solving this problem in
> JDK 25.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250518/31208fb6/attachment-0001.htm>
More information about the core-libs-dev
mailing list