C2 inlining failed because the String constructor is too large
wenshao
shaojin.wensj at alibaba-inc.com
Sun May 18 15:51:15 UTC 2025
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/95eff098/attachment.htm>
More information about the core-libs-dev
mailing list