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
8256368: Avoid repeated upcalls into Java to re-resolve MH/VH linkers/invokers #7429
Conversation
|
@iwanowww The |
Looks good. Is there any reason why we had this optimization for invokedynamic but not invokehandle? |
@iwanowww This change now passes all automated pre-integration checks. 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 4 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
|
Thanks for the reviews, Vladimir and Dean.
It's optional for
In contrast, |
/integrate |
Going to push as commit 534e557.
Your commit was automatically rebased without conflicts. |
It's another attempt to fix JDK-8256368 (previous one was #1453).
@coleenp raised a question about resolution failure case (
indy_resolution_failed()
) and after a closer look it turned out the logic is broken there.After thinking more about it, I decided to completely drop resolution failure case handling and always perform re-resolution.
For MethodHandle/VarHandle invokers resolution failure is very uncommon, so going through re-resolution step seems well-justified.
Original description:
Method linkage of invokehandle instructions involve an upcall into Java
(MethodHandleNatives::linkMethod), but the result is not cached. Unless the
upcall behaves idempotently (which is highly desirable, but not guaranteed),
repeated invokehandle resolution attempts enter a vicious cycle in tiered mode:
switching to a higher tier involves call site re-resolution in generated code,
but re-resolution installs a fresh method which puts execution back into
interpreter.
(Another prerequisite is no inlining through a invokehandle which doesn't
normally happen in practice - relevant methods are marked w/ @forceinline -
except some testing modes, -Xcomp in particular.)
Proposed fix is to inspect ConstantPoolCache first. Previous resolution
attempts from interpreter and C1 records their results there and it stabilises
the execution.
Testing: hs-tier1 - hs-tier4
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7429/head:pull/7429
$ git checkout pull/7429
Update a local copy of the PR:
$ git checkout pull/7429
$ git pull https://git.openjdk.java.net/jdk pull/7429/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7429
View PR using the GUI difftool:
$ git pr show -t 7429
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7429.diff