-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
8005885: enhance PrintCodeCache to print more data #7389
Conversation
👋 Welcome back yftsai! A progress list of the required criteria for merging this PR into |
src/hotspot/share/code/codeCache.cpp
Outdated
} else { | ||
live.add(cb); | ||
if (cb->is_nmethod()) { | ||
const int level = cb->as_nmethod_or_null()->comp_level(); |
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.
is cb->as_nmethod() better?
src/hotspot/share/code/codeCache.cpp
Outdated
live.print("live"); | ||
for (int i = CompLevel_simple; i <= CompLevel_full_optimization; i++) { | ||
tty->print_cr("Tier %d:", i); | ||
if (!live[i - 1].is_empty()) { |
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.
your policy is to skip empty entries. I suggest you move is_empty() logic to CodeBlob_sizes::print().
one side, it would print out "#0 live: empty" instead of skipping it. that's informative.
secondly, it should simplify your code here.
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.
My comments are nits. Generally, this PR looks good to me.
I am not a reviewer. We still need other reviewers to approve it.
src/hotspot/share/code/codeCache.cpp
Outdated
|
||
void print(const char* title) const { | ||
if (is_empty()) | ||
{ |
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.
better stick with the existing codestyle. they always use if (cond) { and else {
src/hotspot/share/code/codeCache.cpp
Outdated
{ "other", &other }, | ||
}; | ||
tty->print_cr("Stubs:"); | ||
for (auto &stub: stubs) { |
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.
current code style prefer auto& stub. same as 1486 1487 lines, asterisk associates with type.
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 not print both absolute size and percentage? E.g., "24K(10%)".
Could include sample output in a comment please?
src/hotspot/share/code/codeCache.cpp
Outdated
struct { | ||
const char* name; | ||
const CodeBlob_sizes* sizes; | ||
} stubs[] = { |
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.
As stub
has a particular meaning and there are non-stubs: adapters buffers and other, I suggest non_nmethod_blobs
instead of stubs
.
src/hotspot/share/code/codeCache.cpp
Outdated
{ "buffer blob", &bufferBlob }, | ||
{ "other", &other }, | ||
}; | ||
tty->print_cr("Stubs:"); |
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.
Non-nmethod blobs:
src/hotspot/share/code/codeCache.cpp
Outdated
for (int i = 0; i <= CompLevel_full_optimization; i++) { | ||
tty->print_cr("Tier %d:", i); |
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.
What about to do it more informative:
Nmethod blobs per compilation level:
CompLevel_none:
...
CompLevel_simple:
...
A snippet from
|
src/hotspot/share/code/codeCache.cpp
Outdated
case CompLevel_none: level_name = "CompLevel_none"; break; | ||
case CompLevel_simple: level_name = "CompLevel_simple"; break; | ||
case CompLevel_limited_profile: level_name = "CompLevel_limited_profile"; break; | ||
case CompLevel_full_profile: level_name = "CompLevel_full_profile"; break; | ||
case CompLevel_full_optimization: level_name = "CompLevel_full_optimization"; break; | ||
default: assert(false, "invalid compLevel"); |
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 please put 'level_name = ; break;' into separate lines? It should improve readability .
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.
They're better aligned now though no separate lines were added.
src/hotspot/share/code/codeCache.cpp
Outdated
for (int i = 0; i <= CompLevel_full_optimization; i++) { | ||
const char *level_name; | ||
switch (i) { | ||
case CompLevel_none: level_name = "CompLevel_none"; break; |
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 would be less verbose if you removed the "CompLevel_" prefix and the underscores in the name strings. I.e., "none", "simple", "limited profile", "full profile", "full optimization".
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.
@yftsai 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 239 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. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@navyxliu, @phohensee) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
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
Have you verified that this change doesn't break any tests? |
Just wanted to mention that there are several tests that match the output of |
No regression was found in tier 2 and 3 tests, and the following tests all pass. There is no change in the output of
|
Okay, thanks for verifying! |
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.
Latest lgtm.
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.
Two minor comments.
@@ -0,0 +1,78 @@ | |||
/* | |||
* Copyright (c) 2022, Amazon.com Inc. or its affiliates. All rights reserved. |
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 don't specify a year any more.
The correct one is "Copyright Amazon.com Inc. or its affiliates. All Rights Reserved." See #6915
/integrate |
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.
One final time, lgtm.
/sponsor |
Going to push as commit b6843a1.
Your commit was automatically rebased without conflicts. |
@phohensee @yftsai Pushed as commit b6843a1. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/7389/head:pull/7389
$ git checkout pull/7389
Update a local copy of the PR:
$ git checkout pull/7389
$ git pull https://git.openjdk.java.net/jdk pull/7389/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 7389
View PR using the GUI difftool:
$ git pr show -t 7389
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/7389.diff