<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
This sounds like a very interesting proposal. If we can split up the constructor, we might be able to merge the two separate yes replacement (constructor) and no replacement (NoRepl) implementations into one down the road.<br>
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I saw the PR <a href="https://github.com/openjdk/jdk/pull/25290">https://github.com/openjdk/jdk/pull/25290</a>, and from the diff (when Hide Whitespace is chosen), I see the change does bring much more consistency.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Chen</div>
<div id="appendonsend"></div>
<hr style="display: inline-block; width: 98%;">
<div id="divRplyFwdMsg" dir="ltr"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of wenshao <shaojin.wensj@alibaba-inc.com><br>
<b>Sent:</b> Sunday, May 18, 2025 10:51 AM<br>
<b>To:</b> core-libs-dev <core-libs-dev@openjdk.org><br>
<b>Subject:</b> C2 inlining failed because the String constructor is too large</span>
<div> </div>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
Through JVM Option +PrintInlining, we found that String has a constructor codeSize of 852, which is too large. This caused failed to inline.</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
<br>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
The following is the output information of PrintInlining:</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
```</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
                @ 9   java.lang.String::<init> (12 bytes)   inline (hot)</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
!m                 @ 1   java.nio.charset.Charset::defaultCharset (52 bytes)   inline (hot)</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
!                  @ 8   java.lang.String::<init> (852 bytes)   failed to inline: hot method too big</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
```</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
<br>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
In Java code, the big method that cannot be inlined is the following constructor</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
<br>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
```java</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
String(Charset charset, byte[] bytes, int offset, int length) {}</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
```</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
<br>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
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. </div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
<br>
</div>
<div style="font-family: Tahoma, Arial, STHeitiSC-Light, SimSun; font-size: 14px; color: rgb(0, 112, 192);">
It is the easiest gain with minimal impact. I suggest solving this problem in JDK 25.</div>
</body>
</html>