-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8265867: thread.hpp defines some enums but no reference #3702
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
This patch also added const and constexpr specifiers for the applicable member functions.
👋 Welcome back xliu! A progress list of the required criteria for merging this PR into |
Webrevs
|
static constexpr ByteSize start_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _start); } | ||
static constexpr ByteSize end_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _end); } | ||
static constexpr ByteSize top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _top); } | ||
static constexpr ByteSize pf_top_offset() { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top); } |
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 constexpr really necessary here? Isn't this usually a constant expression for most compilers?
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 have many of these inline functions that could be either const
and constexpr
. Since constexpr
has been allowed only recently, there are very few functions that are actually declared constexpr
.
My recommendation is to limit constexpr
only to new code. We can change const
to constexpr
when required (e.g., when an existing function is called by new code that's in a constexpr
context). That way, we can limit code churn.
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 and it's more characters to look at for no real performance benefit. These offset functions are in many classes.
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.
Hi Xin,
Please don't mix together cleanups this way. Getting rid of unused enums is fine, but 99% of the patch relates to const and constexpr. I had trouble finding the enum changes among the rest, and what would otherwise be a short and trivial patch becomes more unweildy and requires a lot more time to review. A separate RFE for those would be better IMO.
Thanks,
David
hi, David, Thanks. I will create another JBS to track const and constexpr issue. thanks, |
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 like this change (both the constness fixes and the removal of enums), but as David said, please make them two changes and give them clear titles.
Wrt to the constexpr, I am not against this since constexpr is to my understanding mostly a safety measure against bitrot, preventing us from accidentally making a constexpr function non-const. But the majority seems not to like that part, so I'd just leave it out for now.
Cheers, Thomas
src/hotspot/share/runtime/thread.hpp
Outdated
@@ -1086,7 +1074,7 @@ class JavaThread: public Thread { | |||
|
|||
// last_Java_sp | |||
bool has_last_Java_frame() const { return _anchor.has_last_Java_frame(); } | |||
intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); } | |||
intptr_t* last_Java_sp() const { return _anchor.last_Java_sp(); } |
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 the whitespace change?
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 try to align with above "const". I will format this patch better next time.
@navyxliu 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 53 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 (@dholmes-ora, @tstuefe, @iklam, @coleenp) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Thanks reviewers. I took a look at the building failure on macos. it should not be relevant to this patch.
|
/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.
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.
Looks good - and now trivial :)
Thanks,
David
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.
+1
/sponsor |
@iklam @navyxliu Since your change was applied there have been 58 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 164454f. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Deleted 2 useless enums.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3702/head:pull/3702
$ git checkout pull/3702
Update a local copy of the PR:
$ git checkout pull/3702
$ git pull https://git.openjdk.java.net/jdk pull/3702/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 3702
View PR using the GUI difftool:
$ git pr show -t 3702
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3702.diff