-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8266252: Streamline AbstractInterpreter::method_kind #3798
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
Conversation
|
👋 Welcome back redestad! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
/label remove hotspot |
|
@cl4es |
|
@cl4es |
iklam
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.
Looks good to me. Just a minor nit about asserts.
For other reviewers, you can get better diffs by adding ?w=1 to ignore whitespace changes. I.e., https://github.com/openjdk/jdk/pull/3798/files?w=1
| case vmIntrinsics::_dabs: return java_lang_math_abs; | ||
| // _dsqrt will be selected for both Math::sqrt and StrictMath::sqrt, but the latter | ||
| // is native. Keep treating it like a native method in the interpreter | ||
| case vmIntrinsics::_dsqrt: return m->is_native() ? native : java_lang_math_sqrt; |
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.
Maybe we should add an assert that m must be one of the two methods mentioned by the above 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.
Ok. I'll add an assertion that allows for the StrictMath variant to be re-implemented in java
|
@cl4es 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 36 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 |
coleenp
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.
Ok with some minor nits and questions.
| case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits; | ||
| default: break; | ||
| } | ||
| switch (m->intrinsic_id()) { |
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.
Can this just be switch (id) since you fetched m->intrinsic_id() above?
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.
Yes, or maybe iid is a better name for that variable.
| case vmIntrinsics::_floatToRawIntBits: return java_lang_Float_floatToRawIntBits; | ||
| case vmIntrinsics::_longBitsToDouble: return java_lang_Double_longBitsToDouble; | ||
| case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits; | ||
| case vmIntrinsics::_dsin: return java_lang_math_sin; |
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.
So ZERO doesn't have these?
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.
Hmm, I looked at the math intrinsics, which are all unimplemented in zero. I see now that there are some intrinsics implemented in ZERO, so I'll take the conservative route and move the #ifndef to only exclude such cases as were excluded before.
| case vmIntrinsics::_intBitsToFloat: return java_lang_Float_intBitsToFloat; | ||
| case vmIntrinsics::_floatToRawIntBits: return java_lang_Float_floatToRawIntBits; | ||
| case vmIntrinsics::_longBitsToDouble: return java_lang_Double_longBitsToDouble; | ||
| case vmIntrinsics::_doubleToRawLongBits: return java_lang_Double_doubleToRawLongBits; |
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.
Could you align these return statements?
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.
Ok, I'll try tidying up - is there some rule of thumb on how to align in a switch like this where the longest case label is.. pretty long?
|
|
||
| // Native method? | ||
| // Note: This test must come _before_ the test for intrinsic | ||
| // methods. See also comments below. |
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.
So apparently this is no longer true?
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.
The one case of a native and intrinsic method is StrictMath::sqrt, which is handles specially above to retain the order of precedence.
… need to include method.inline.hpp there
|
/integrate |
|
@cl4es Since your change was applied there have been 39 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit e41fd73. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This patch refactors AbstractInterpreter::method_kind to reduce branches on average while better compartmentalizing the exceptional cases.
Additionally Method::is_empty_method is trivial enough that making it inlineable helps reduce cost while reducing size of the libjvm.
Result is a 40% speed-up, or a reduction of .25% of instructions on Hello World that scales to larger applications.
Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3798/head:pull/3798$ git checkout pull/3798Update a local copy of the PR:
$ git checkout pull/3798$ git pull https://git.openjdk.java.net/jdk pull/3798/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3798View PR using the GUI difftool:
$ git pr show -t 3798Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3798.diff