-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8276711: compiler/codecache/cli tests failing when SegmentedCodeCache used with -Xint #7650
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 coleenp! A progress list of the required criteria for merging this PR into |
Webrevs
|
if (_mode == _int) { | ||
if (SegmentedCodeCache) { | ||
warning("SegmentedCodeCache has no meaningful effect with -Xint"); | ||
FLAG_SET_DEFAULT(SegmentedCodeCache, false); | ||
} | ||
} |
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.
Isn't this better placed in Arguments::set_mode_flags where the other compiler related flags get turned off?
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.
SegmentedCodeCache
should be set in compiler/compilerDefinitions.cpp
:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/compiler/compilerDefinitions.cpp#L294
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 replied on email but I don't see it and this is better here. I should really change this to be:
if (FLAG_IS_CMDLINE(SegmentedCodeCache)) {
}
Since this code is checking for someone setting it on the command line with -Xint. The code in compilerDefinitions.cpp sets the flag ergonomically if the code cache is big and if tiered compilation is on. I believe this is after the code in arguments.cpp. So this code won't reset it to true, if I'm following it right.
edit: yes, I'll check the flag in compilerDefinitions.cpp.
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 agree that the warning should be issued if flag is set on command line together with -Xint
.
In this case you need add this check to CompilerConfig::check_args_consistency()
where different compiler flags are set to false when we run with Interpreter:
https://github.com/openjdk/jdk/blob/master/src/hotspot/share/compiler/compilerDefinitions.cpp#L493
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 Coleen, seems the use of set_mode_flags
is somewhat flawed as you can change any of the flags that it tries to force on/off simply by having them later on the command-line.
You could do as @vnkozlov suggests and move this check into compilerDefinitions.cpp
as CompilerConfig::ergo_initialize()
is called just a few lines above 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 Vladimir, that's a better place for it. There are other checks for inconsistent flags with -Xint in check_args_consistency(). One of the tests still fails with that change so I'll have to figure out why.
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 moved the check but TieredStopAtLevel=0 still allocates code heaps for nmethods, so the check only checks for the -Xint in arguments. I don't know if this makes sense or not in the code heap allocation code, but the codecache/cli tests test for sizes of code heaps pass with this change.
Mailing list message from coleen.phillimore at oracle.com on hotspot-dev: On 3/1/22 4:29 PM, David Holmes wrote:
Well, the default for SegmentedCodeCache is off.? It's set here because if (FLAG_IS_CMDLINE(SegmentedCodeCache)) { to make it more clear. Coleen |
@@ -524,6 +523,13 @@ bool CompilerConfig::check_args_consistency(bool status) { | |||
#endif | |||
} | |||
|
|||
// TieredStopAtLevel==0 allocates nmethod space in the code heap with | |||
// SegmentedCodeCache so only disallow the option for -Xint. | |||
if (Arguments::is_interpreter_only() && FLAG_IS_CMDLINE(SegmentedCodeCache)) { |
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.
You need to check SegmentedCodeCache==true
else you will generate the warning if someone is explicitly turning it off in combination with -Xint
.
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, code should follow pattern in previous lines:
if (SegmentedCodeCache) {
if (!FLAG_IS_DEFAULT(SegmentedCodeCache)) {
warning("SegmentedCodeCache has no meaningful effect with -Xint");
}
FLAG_SET_CMDLINE(SegmentedCodeCache, false);
}
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.
And you should include it in previous scope which checks if (Arguments::is_interpreter_only())
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 previous scope checks CompilerConfig::is_interpreter_only() which includes TieredStopAtLevel == 0, so it's not the same there.
@@ -524,6 +523,13 @@ bool CompilerConfig::check_args_consistency(bool status) { | |||
#endif | |||
} | |||
|
|||
// TieredStopAtLevel==0 allocates nmethod space in the code heap 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 would prefer to not have special case TieredStopAtLevel==0
. Unless you want to test loom when JIT compilers are disabled. Currently we don't run any tests with such setting.
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 tested with this setting and it works fine with -XX:+SegmentedCodeCache because the code for segmented code cache only checks Arguments::is_interpreter_only(). This doesn't seem right to me, but the testing also expects this to work. I could fix the tests to not do this. Now I don't know what anyone wants!
… a nmethod heaps, and fix tests accordingly.
I pushed a change to make TieredStopAtLevel=0 also disable SegmentCodeCache and fixed the tests for that also, but am rerunning tests tier1-4, then 5-6. |
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.
@coleenp 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 12 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. Tiers 1-4 passed. Now 5-6 also. |
@@ -368,7 +368,7 @@ bool CodeCache::heap_available(int code_blob_type) { | |||
if (!SegmentedCodeCache) { | |||
// No segmentation: use a single code heap | |||
return (code_blob_type == CodeBlobType::All); | |||
} else if (Arguments::is_interpreter_only()) { | |||
} else if (CompilerConfig::is_interpreter_only()) { |
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.
Doesn't this introduce a very subtle change in behaviour in relation to the handling of MethodNonProfiled
?
@vnkozlov please confirm this is what you intended - I don't know the implications.
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.
According to my conversation with Rickard, TierStopAtLevel=0 is the same as -Xint. If TieredStopAtLevel=0, the compiler won't allocate nmethods in the MethodProfiled and MethodNonProfiled areas anyway, so this won't allocate them now.
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 think this code was missed during Igor's V. changes which introduced CompilerConfig::is_interpreter_only()
.
Coleen is correct, with TieredStopAtLevel=0
all JIT compilers are disabled. MethodNonProfiled
is codeheap for tier1 (C1) and tier4 (C2) compiled nmethods. It does not make sense to have such codeheap when compilation disabled.
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.
Okay, so does that mean this block:
} else {
// No TieredCompilation: we only need the non-nmethod and non-profiled code heap
return (code_blob_type == CodeBlobType::NonNMethod) ||
(code_blob_type == CodeBlobType::MethodNonProfiled);
}
is actually unreachable?
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.
It is reachable for -XX:-TieredCompilation
when only C2 is used. Or when only tier1 C1 is used with -XX:TieredStopAtLevel=1
.
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.
Ah I see. Thanks for clarifying @vnkozlov !
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.
-XX:TieredStopAtLevel=1 is the old -client switch. Thanks Vladimir for confirming.
Thanks David. |
Going to push as commit 7822cbc.
Your commit was automatically rebased without conflicts. |
In Loom, when using -Xint, the +SegmentedCodeCache option cannot be used because it doesn't generate a code heap for nmethods, and in loom the compiler needs to generate an nmethod for Continuation.enterSpecial even with -Xint.
This change is @rickard 's loom change with the tests fixed so they pass for it. One tests for the new warning message and code cache usage, and the others remove the Xint tests.
Tested with tier1-4.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7650/head:pull/7650
$ git checkout pull/7650
Update a local copy of the PR:
$ git checkout pull/7650
$ git pull https://git.openjdk.java.net/jdk pull/7650/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7650
View PR using the GUI difftool:
$ git pr show -t 7650
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7650.diff