-
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
8339113: AccessFlags can be u2 in metadata #22246
Conversation
👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into |
@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 67 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 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. |
5d7ae0a
to
3106bdd
Compare
Webrevs
|
@coleenp This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
No, bot, this is a new PR. |
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 in principle but use of as_int()
is very confusing.
The as_int() was because we are using the AccessFlags as an integral value. I was trying to minimize the effects of the change and the code uses AccessFlags as an integral value. as_int() returns u2 so I guess that's confusing. I don't want AccessFlags::get_flags() because that's implies the return is AccessFlags. I could change the name to as_unsigned_short(). Would that be less confusing? Thank you David for looking through this change. |
Co-authored-by: David Holmes <[email protected]>
Co-authored-by: David Holmes <[email protected]>
src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp
Outdated
Show resolved
Hide resolved
…method, field and class modifiers into AccessFlags. Change ciFlags to use AccessFlags.
How about |
I didn't really like that name since it's the name of the type rather than more of a description of the type returned. I was able to reduce the number of these by adding some helper functions in AccessFlags. |
Things become somewhat clearer once one realizes/recalls that
as it originally did. |
Thanks for adding the patch Coleen :-) I did another test-run and s390x looks fine now. |
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/AccessFlags.java
Outdated
Show resolved
Hide resolved
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.
Thank you for update with this an unification!
I've posted a couple of comments with similar nits.
src/hotspot/share/opto/memnode.cpp
Outdated
return TypeInt::make(klass->modifier_flags()); | ||
} | ||
if (tkls->offset() == in_bytes(Klass::access_flags_offset())) { | ||
// The field is Klass::_access_flags. Return its (constant) value. | ||
// (Folds up the 2nd indirection in Reflection.getClassAccessFlags(aClassConstant).) | ||
assert(this->Opcode() == Op_LoadI, "must load an int from _access_flags"); | ||
assert(this->Opcode() == Op_LoadUS, "must load an unsigned short from _access_flags"); |
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.
Nit: This can be unified with line 1979 and also get rid of 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.
1979 and 1985 are in different branches of an if statement (address of modifier flags vs access flags) so needs to be repeated. But I did remove the 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.
I can't say that I really understand which API's are fine with flags-as-int and which need to care about the actual flag storage size. but I'll leave it at that. I will tick approve for the shared code portion of the change.
Thanks
Thanks David. I'm hoping @iwanowww or @dean-long can review the compiler parts. |
Sure, I'll try to take a look at it tomorrow. |
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.
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.
JVMCI changes look good to me!
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.
Thank you for one more unification update! Looks good.
@@ -36,31 +36,31 @@ | |||
#include "utilities/tribool.hpp" | |||
|
|||
// These are flag-matching functions: | |||
inline bool match_F_R(jshort flags) { | |||
inline bool match_F_R(u2 flags) { |
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 wish more code could be size-agnostic. So instead of using u2
here, there could be a typedef in accessFlags.hpp that we could use that hides the size. However, it's not a big deal, because it seems unlikely this type will change much in the future without a JVM spec change. I'm tempted to suggesting using AccessFlags here, but it's a class. Since this is an end-point "consumer" of the type that doesn't store it or pass it along, we could even use something like uint
here.
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.
That seems like a good idea if this weren't so limited. I did chat with DanH. to see if access flags will ever grow in size from u2 and he was doubtful that would ever happen. uint would work here too, but this small use might prevent some future -Wconversion warnings and doesn't hurt anything.
Thank you for reviewing.
This does seem like a good future cleanup. Thanks for reviewing Vladimir. |
Thanks for reviewing David, Yudi and Serguei. I reran tiers 1-7 on this change. |
Going to push as commit 098afc8.
Your commit was automatically rebased without conflicts. |
Please review this change that makes AccessFlags and modifier_flags u2 types and removes the last remnants of Hotspot adding internal access flags. This change moves AccessFlags and modifier_flags in Klass to alignment gaps saving 16 bytes. From pahole: so it's a bit better.
before:
after:
We may eventually move the modifiers to java.lang.Class but that's WIP.
Tested with tier1-7 on oracle platforms. Did test builds on other platforms (please try these changes ppc/arm32 and s390). Also requires minor Graal changes.
Progress
Issue
Reviewers
Contributors
<[email protected]>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22246/head:pull/22246
$ git checkout pull/22246
Update a local copy of the PR:
$ git checkout pull/22246
$ git pull https://git.openjdk.org/jdk.git pull/22246/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 22246
View PR using the GUI difftool:
$ git pr show -t 22246
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22246.diff
Using Webrev
Link to Webrev Comment