-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
8329126: No native wrappers generated anymore with -XX:-TieredCompilation after JDK-8251462 #18496
8329126: No native wrappers generated anymore with -XX:-TieredCompilation after JDK-8251462 #18496
Conversation
👋 Welcome back simonis! A progress list of the required criteria for merging this PR into |
@simonis 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 29 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 |
Webrevs
|
…tion after JDK-8251462
7eb0d11
to
157e124
Compare
@simonis Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
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.
We need a regression test to catch this in a future.
Have you found out why exact are the wrappers not created with |
Regarding the solution. You seem to be tapping into the
What do you think? Would that work? |
I think it will work, but wouldn't that instantly create a native wrapper for every native method? Shouldn't we only create native wrappers for hot native methods? |
The reason why they are not created is because native methods have no MDO so we always bail out here: case CompLevel_full_profile:
{
MethodData* mdo = method->method_data();
if (mdo != nullptr) {
if (mdo->would_profile() || CompilationModeFlag::disable_intermediate()) {
int mdo_i = mdo->invocation_count_delta();
int mdo_b = mdo->backedge_count_delta();
if (Predicate::apply(method, cur_level, mdo_i, mdo_b)) {
next_level = CompLevel_full_optimization;
}
} else {
next_level = CompLevel_full_optimization;
}
} |
To get here it will have to be already relatively hot. And since we don't need to profile it I think it would be fair to treat it exactly the same way we treat trivial methods. |
OK, then better early than never :) |
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.
LGTM
I submitted our testing for v03 version. |
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.
My tier1-3,xcomp,stress testing passed.
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 catch! Looks good.
/integrate |
Going to push as commit f2e5808.
Your commit was automatically rebased without conflicts. |
Since JDK-8251462: Simplify compilation policy, introduced in JDK 17, no native wrappers are generated any more if running with
-XX:-TieredCompilation
(i.e. native methods are not compiled any more).The attached JMH benchmark demonstrate that native method calls became twice as expensive with JDK 17:
JDK 11
JDK 17 & 21
The issue can bee seen if we run with
-XX:+PrintCompilation -XX:+PrintInlining
. With JDK 11 we get the following output for-XX:+TieredCompilation
:As you can see, the native wrapper for
NativeCall::emptyStaticNativeMethod()
gets compiled with compiled id 112. If we run with-XX:-TieredCompilation
:There's still a native wrapper created with compile id 6.
With JDK 17 and later, the
-XX:+PrintCompilation
output looks similar for the default-XX:+TieredCompilation
case:But with
-XX:-TieredCompilation
, we don't generate the native wrapper any more:Which basically means that we're always invoking the native method through the interpreter stub.
There are certainly different ways to fix this issue. The one proposed in this PR seemed simple and non-intrusive to me but I'm open for better alternatives. I'd especially appreciate if @veresov could take a look and advice.
Once we agree on the problem and a solution for it, I can also add a test and potentially the JMH benchmark from the JBS issue to this PR.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/18496/head:pull/18496
$ git checkout pull/18496
Update a local copy of the PR:
$ git checkout pull/18496
$ git pull https://git.openjdk.org/jdk.git pull/18496/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 18496
View PR using the GUI difftool:
$ git pr show -t 18496
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/18496.diff
Webrev
Link to Webrev Comment