-
Notifications
You must be signed in to change notification settings - Fork 6k
8359064: Expose reason for marking nmethod non-entrant to JVMCI client #25706
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
8359064: Expose reason for marking nmethod non-entrant to JVMCI client #25706
Conversation
👋 Welcome back cslucas! A progress list of the required criteria for merging this PR into |
@JohnTortugo 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 154 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 |
@JohnTortugo The following labels 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 lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
Thank you for working on this. Now #25338 makes even more sense 😄 A naive question: is it possible to somehow share the enum definition in hotspot with the Java side in JVMCI? If all change reasons were enums, they would be much easier to understand. |
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/InstalledCode.java
Outdated
Show resolved
Hide resolved
Not directly but you can have a mirror enum in JVMCI whose ordinal and message could be kept in sync and initialized from native code. As an example, see jdk.vm.ci.hotspot.HotSpotCompiledCodeStream.Tag. |
Thank you for the comments. I added the comments that you asked @dougxc and I did some refactoring around the definition of the ChangeReason enum in the JVMCI API. |
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/code/InstalledCode.java
Outdated
Show resolved
Hide resolved
While the new ChangeReason JVMCI enum looks nice, I don't quite get how/where it is (or should be) used? It seems disconnected from the |
In general, I don't find the name ChangeReason quite models the concept properly - wouldn't "InvalidationReason" be more accurate? "change" is a very broad concept. |
I think all JVMCI Java level tracking of change (or invalidation) reasons should be confined to |
I agree, I also have that feeling because the type of the field is not the enum. I'll refactor that. The end goal here mainly (but not only) is to be able to use this "change or invalidation reason" to reset Truffle CallTarget profiles when its installed code was evicted from the code cache because it was "cold". See this draft PR that I'm preparing for Truffle - it contains some spurious changes right now.
I agree that "change" is broad, but is it a bad thing in this context? Shouldn't both sides of JVMCI (if they want to) be able to "monitor" any change that the other side did to an installed code? "invalidationReason" may not be great as well because the field will be also set when the code is installed.
IMHO it seemed right to add the field in the "InstalledCode" class because having a simple way to communicate back-and-forth that a change occurred, and why it occurred, felt like a good thing to have overall. I understand that not all users of JVMCI may use it. If you feel strongly about this I can move the field to HotSpotNmethod. |
The only change we're talking about is invalidation via Why will the field be set when the code is installed? Do you mean it will be initialized to the default All the current reasons are HotSpot specific and the very notion of "change" is exactly tied to |
I was referring to the change made in
Sounds good to me. I'll rename the field to |
…a side; rename field to invalidationReason
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java
Outdated
Show resolved
Hide resolved
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java
Show resolved
Hide resolved
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java
Outdated
Show resolved
Hide resolved
src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotNmethod.java
Outdated
Show resolved
Hide resolved
Thank you for commenting @tkrodriguez .
If by "it" you mean Truffle then the answer is no. The main point of this change is to communicate to Truffle when something in the HotSpot side invalidated the code, in particular I'm interested in the situation when the heuristics that monitor the code cache caused the eviction of a nmethod because it considered it cold. Truffle itself uses a different concept of hot/cold method... |
Sorry for the confusion on my part. The lack of a PR that's consuming these changes makes it harder to know which parts are the important ones. |
@tkrodriguez , @dougxc - are you OK with the latest changes I pushed? |
Modulo the comment I just made, these changes now look good. |
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.
Module my comments about the enum it looks good to me.
/integrate |
Going to push as commit 2fe1298.
Your commit was automatically rebased without conflicts. |
@JohnTortugo Pushed as commit 2fe1298. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
@JohnTortugo the new test is failing in our CI - please see https://bugs.openjdk.org/browse/JDK-8360049 |
We recently introduced a way to set the reason why a nmethod was being marked as
not entrant
, see here and here.This PR is to expose in the JVMCI interface the reason why the nmethod was flagged as
not entrant
. This will allow JVMCI-based compilers to implement heuristics to handle re-compilations differently based on what happened to earlier versions of a method, for instance, this will likely be used to address this RFE in Truffle.Tested on Linux x86_64, ARM with JTREG tier 1-3.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25706/head:pull/25706
$ git checkout pull/25706
Update a local copy of the PR:
$ git checkout pull/25706
$ git pull https://git.openjdk.org/jdk.git pull/25706/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 25706
View PR using the GUI difftool:
$ git pr show -t 25706
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25706.diff
Using Webrev
Link to Webrev Comment