-
Notifications
You must be signed in to change notification settings - Fork 64
8279515: C1: No inlining through invokedynamic and invokestatic call sites when resolved class is not linked #80
Conversation
|
👋 Welcome back vlivanov! A progress list of the required criteria for merging this PR into |
vnkozlov
left a comment
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.
Seems reasonable.
|
@iwanowww 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 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
dean-long
left a comment
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.
Solution makes sense. I had my doubts about the get_declared_method_holder() behavior.
|
Thanks for the review, Vladimir and Dean. /integrate |
|
Going to push as commit ad34f03.
Your commit was automatically rebased without conflicts. |
JDK-8267806 broke inlining at
invokedynamicandinvokestaticcall sites in some circumstances. Though the enhancement was intended to relax the inlining checks, it introduced one new check to ensure that resolved klass (REFC) is linked. It turned out the check is too strong: resolution of the symbolic class reference at a call site does not trigger class linkage.For
invokestaticconsider the following example:Method resolution loads class
Balong the way, but neither initialises nor links it. Invocation does trigger class initialisation, but only for classA.For
invokedynamicit's a bit more complicated. Syntactically, there's no symbolic class reference at the call site, but CI assigns an artificial one (java.lang.invoke.MethodHandle, seeciBytecodeStream::get_declared_method_holder()). The problem isMethodHandleclass doesn't have to be loaded by the class loader of the accessing class, sociEnv::get_klass_by_name()can produce unloaded CI mirror (ciKlass).For example, indy call site linkage of indified string concatenation (
StringConcatFactory.makeConcatWithConstants()) doesn't getMethodHandleclass recorded in the context class loader [1] whileLambdaMetafactory.metafactory()introduces a class loader constraint for it [2] which reveals the class to the subsequent class lookup. I decided to make
ciBytecodeStream::get_declared_method_holder()predictable and return well-known VM class right away without doing the lookup.Proposed fix relaxes the constraint on resolved class (
REFC) and requires it to be loaded.Also, while working on the fix, I spotted that the constraint for
invokestaticis also too strong (requires resolved class to be initialized while the specification mandates resolved method holder to be initialized instead):I fixed it as well (
s/callee_holder/klass/).Testing: hs-tier1 - hs-tier4
[1]
[2]
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk18 pull/80/head:pull/80$ git checkout pull/80Update a local copy of the PR:
$ git checkout pull/80$ git pull https://git.openjdk.java.net/jdk18 pull/80/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 80View PR using the GUI difftool:
$ git pr show -t 80Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk18/pull/80.diff