-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Use StringConcatFactory
for string concatenation on JDK 9+
#12929
Conversation
JEP 280, released in JDK 9, proposes a new way to compile string concatenation using `invokedynamic` and `StringConcatFactory`. This new approach generates less bytecode, doesn't have to incur the overhead of `StringBuilder` allocations, and allows users to pick swap the concatenation technique at runtime. This changes the codegen when the target is at least Java 9 to leverage `invokedynamic` and `StringConcatFactory`. On Java 8, the old `StringBuilder` approach is still used. Ported from scala#9556
@smarter @harpocrates what's the status on this one? Is there more work that needs to be done? Or does this only need a reviewer? |
@anatoliykmetyuk there's two code issues. I think I can do these, but I'd be happy if someone else picked it up (I've forgotten all of Dotty's conventions around testing).
Somewhat separately though: this adds a separate Java 9+ codepath. Is there any CI job that tests that? Scala 2 runs at least one JDK 17 CI run, but I don't see anything analogous in Dotty. I'm not sure that it is a good idea to merge code if it isn't ever going to be checked in CI... |
by default the CI (e.g. |
What conventions do you mean? If it helps, here's a docs page on how to run tests. Also, the workflow doc page may help. Tests themselves go in the tests directory, commonly into pos directory for tests expected to compile, run – for runtime tests, and neg for those that don't. T |
I've updated the test and it passes locally on my machine. |
Looking at the CI: is there a way to also run |
If you edit the PR description (but not the PR title) to contain the string |
7f96c3e
to
84ed337
Compare
The |
Great, however I won't be able to review this in the next two weeks, maybe @lrytz could have a look since he reviewed scala/scala#9556 ?
Yes this is a known issue: #13176 |
|
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.
It's fine to ignore the failing job since we know it's unrelated to this PR. |
JEP 280, released in JDK 9, proposes a new way to compile string
concatenation using
invokedynamic
andStringConcatFactory
.This new approach generates less bytecode, doesn't have to incur
the overhead of
StringBuilder
allocations, and allows users topick swap the concatenation technique at runtime.
This changes the codegen when the target is at least Java 9 to
leverage
invokedynamic
andStringConcatFactory
. On Java 8,the old
StringBuilder
approach is still used.Ported from scala/scala#9556
[test_java8]