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
8271911: replay compilations of methods which use JSR292 (easy cases) #5270
Conversation
👋 Welcome back dlong! A progress list of the required criteria for merging this PR into |
/id 8012267 |
@dean-long Unknown command |
/help |
@dean-long Available commands:
|
/issue 8271911, 8012267 |
@dean-long This issue is referenced in the PR title - it will now be updated. Adding additional issue to issue list: |
@dean-long The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
/issue 8012268 |
@dean-long |
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.
In general this looks good.
My only complain is lack of comments. It difficult to understand what happens in code.
Thanks Vladimir for looking at this. Let me know if I missed some places that need comments. |
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 good.
@dean-long 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 90 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 |
Thanks Vladimir. |
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.
Very nice work, Dean!
_dyno_locs = new (arena()) GrowableArray<const char *>(arena(), 100, 0, NULL); | ||
|
||
// Iterate over the class hierarchy | ||
for (ClassHierarchyIterator iter(vmClasses::Object_klass()); !iter.done(); iter.next()) { |
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.
Why do you iterate over the whole class hierarchy instead of inspecting only those classes which are present in CI?
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 question. It is because of the section in ciInstanceKlass::dump_replay_data that dumps subclasses. If one of the CI classes is java.lang.Object, we can get a lot of hidden classes dumped there from startup that are unrelated to the current compile. I wanted to see how many I could find as a proof of concept / stress test. My plan is to see if we can completely do without subclass dumping there by dumping better CHA information (JDK-8261192).
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.
I still miss the connection between ciInstanceKlass::dump_replay_data()
and ciEnv::find_dynamic_call_sites()
cases.
ciEnv::find_dynamic_call_sites()
dumps all invokedynamic and invokehandle (MH.invoke*()) call sites and MethodHandle CP Constants across the class hierarchy. Any particular benefit compared to just dumping that info on per ciInstanceKlass granularity?
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.
Also, one more question: why do you dump MethodHandle CP constants and invokehandle call sites? Is it to record the connection between MethodHandle instances and hidden classes behind LambdaForms they are implemented with?
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.
I still miss the connection between
ciInstanceKlass::dump_replay_data()
andciEnv::find_dynamic_call_sites()
cases.
ciEnv::find_dynamic_call_sites()
dumps all invokedynamic and invokehandle (MH.invoke*()) call sites and MethodHandle CP Constants across the class hierarchy. Any particular benefit compared to just dumping that info on per ciInstanceKlass granularity?
Actually, find_dynamic_call_sites doesn't do the dumping, it just builds a map, so we only dump call sites that for hidden classes that are referenced in the replay data, preserving existing behavior. The dumping of subclasses in ciInstanceKlass::dump_replay_data confused me too, so I asked Tom Rodriguez about it. It's a substitute for CHA info in the reply file. If we load sublcasses of all the ciInstanceKlass's, then hopefully CHA queries will give the same answer at replay time. Note that not all subclasses have a ciInstanceKlass in the metadata. Subclasses of java.lang.Object include lots of hidden classes not referenced directly in the ci metadata.
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.
Also, one more question: why do you dump MethodHandle CP constants and invokehandle call sites? Is it to record the connection between MethodHandle instances and hidden classes behind LambdaForms they are implemented with?
Yes, if I understand your question correctly. When inlining through an invokedynamic to the target, there's often an invokehandle at the end, and the hidden class isn't always found as the adapter or appendix. There are other locations like BSM arguments, but these are loaded from the constant pool and I found that looking at MethodHandle CP constants handled that case. Note again that I don't dump all MethodHandle CP constants, just the ones needed for a hidden class referenced in the reply data.
@iwanowww Thanks for looking at 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.
Thanks for the clarifications, Dean.
Looks good.
/integrate |
Going to push as commit 14a3ac0.
Your commit was automatically rebased without conflicts. |
@dean-long Pushed as commit 14a3ac0. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
There is a subset of the general problem that we should be able to solve by looking at invokedynamic/invokehandle call sites and MethodHandle constant pool entries. If a replay references a hidden class that is discoverable in one of those locations, then we can use the location as a replacement for the transient VM name.
Examples of references to hidden class locations:
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/5270/head:pull/5270
$ git checkout pull/5270
Update a local copy of the PR:
$ git checkout pull/5270
$ git pull https://git.openjdk.java.net/jdk pull/5270/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 5270
View PR using the GUI difftool:
$ git pr show -t 5270
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/5270.diff