-
Notifications
You must be signed in to change notification settings - Fork 5.9k
8327247: C2 uses up to 2GB of RAM to compile complex string concat in extreme cases #18953
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
👋 Welcome back redestad! A progress list of the required criteria for merging this PR into |
@cl4es This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 15 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only with ASM can we realize how concise ClassFile API is!
* to what javac would. No exact sizing of parameters or estimates. | ||
*/ | ||
private static final class SimpleStringBuilderStrategy { | ||
static final int CLASSFILE_VERSION = ClassFile.latestMajorVersion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still breaks backward ASM port, we should use a fixed version like 52 for JAVA_8 and convert to latest only in the CF conversion later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. In the code I am reviving this field was simply set to 52
. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: the copyright header needs update before integration.
Also a side note for backport: ClassFileDumper exists only since JDK 21, so for earlier backports you need to use an alternative dumping method or remove dumping ability. |
Yes, original code used ProxyClassDumper, which was renamed/reworked in 21 by JDK-8304846. I think we've gone as far as we can code-wise in ensuring this is cleanly backportable to at least 21. I'll add a comment about ProxyClassDumper. |
@shipilev are you OK with this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks okay, thanks. Only cosmetic nits:
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
Outdated
Show resolved
Hide resolved
src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java
Outdated
Show resolved
Hide resolved
Thanks, nits resolved. Also some minor improvement (improved for; use iconst(mv, len) as originally intended) |
Running another round of sanity testing (tier1+2) before integration. |
/integrate |
Going to push as commit 5e2ced4.
Your commit was automatically rebased without conflicts. |
Splitting out the ASM-based version from #18690 to push that first under the JBS (to help backporting). Keeping #18690 open to rebase and follow-up on this as a subtask. See discussion in that #18690 for more details, discussion and motivation for this.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18953/head:pull/18953
$ git checkout pull/18953
Update a local copy of the PR:
$ git checkout pull/18953
$ git pull https://git.openjdk.org/jdk.git pull/18953/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18953
View PR using the GUI difftool:
$ git pr show -t 18953
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18953.diff
Webrev
Link to Webrev Comment