Skip to content

Conversation

@wenshao
Copy link

@wenshao wenshao commented Nov 28, 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

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.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8357289 needs maintainer approval

Issue

  • JDK-8357289: Break down the String constructor into smaller methods (Enhancement - P4 - Requested)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/32/head:pull/32
$ git checkout pull/32

Update a local copy of the PR:
$ git checkout pull/32
$ git pull https://git.openjdk.org/jdk25u-dev.git pull/32/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 32

View PR using the GUI difftool:
$ git pr show -t 32

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/32.diff

Using Webrev

Link to Webrev Comment

@wenshao
Copy link
Author

wenshao commented Nov 28, 2025

/approval 8357289 request This PR makes minimal changes, but significantly improves the performance of constructing Strings, so it requests a backport to JDK 25. The code logic remains unchanged, requiring no additional testing, and the risk is relatively low.

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 28, 2025

👋 Welcome back swen! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Nov 28, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added approval Requires approval; will be removed when approval is received rfr Pull request is ready for review labels Nov 28, 2025
@openjdk
Copy link

openjdk bot commented Nov 28, 2025

@wenshao
8357289: The approval request was already up to date.

@mlbridge
Copy link

mlbridge bot commented Nov 28, 2025

Webrevs

@wenshao wenshao changed the title 8357289: Break down the String constructor into smaller methods Backport 839cede1a46b05d27abeaffbbd82c241910035cd Dec 1, 2025
@openjdk openjdk bot changed the title Backport 839cede1a46b05d27abeaffbbd82c241910035cd 8357289: Break down the String constructor into smaller methods Dec 1, 2025
@openjdk
Copy link

openjdk bot commented Dec 1, 2025

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

1 participant