8381238: Remove tautological uses of checked_cast#30482
8381238: Remove tautological uses of checked_cast#30482kimbarrett wants to merge 1 commit intoopenjdk:masterfrom
Conversation
|
👋 Welcome back kbarrett! A progress list of the required criteria for merging this PR into |
|
@kimbarrett This change is no longer ready for integration - check the PR body for details. |
|
@kimbarrett The following label 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 list. If you would like to change these labels, use the /label pull request command. |
mhaessig
left a comment
There was a problem hiding this comment.
Thank you for fixing these, @kimbarrett. This looks good.
dholmes-ora
left a comment
There was a problem hiding this comment.
Looks good to me. But one does have to wonder why such casts were used in the first place.
| stream->write_int(value()); | ||
| if(is_callee_saved() || is_derived_oop()) { | ||
| stream->write_int(checked_cast<int>(content_reg()->value())); | ||
| stream->write_int(content_reg()->value()); |
There was a problem hiding this comment.
So this was put in by JDK-8309685 to apparently suppress a conversion warning (though I can't see how a function typed as int could possibly cause such a warning ???). Was that change in error or have the warnings changed since then?
There was a problem hiding this comment.
Some of these checks make the code safe when the types of code elsewhere change. Just because something is a 32-bit type today doesn't tell us it always will be.
There was a problem hiding this comment.
Hi @kimbarrett, thanks for making a comment in an OpenJDK project!
All comments and discussions in the OpenJDK Community must be made available under the OpenJDK Terms of Use. If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please Use "Add GitHub user kimbarrett" for the summary.
If you are not an OpenJDK Author, Committer or Reviewer, simply check the box below to accept the OpenJDK Terms of Use for your comments.
- I agree to the OpenJDK Terms of Use for all comments I make in a project in the OpenJDK GitHub organization.
Your comment will be automatically restored once you have accepted the OpenJDK Terms of Use.
There was a problem hiding this comment.
Hmm I was wrong above - it seems stream->write_int takes a juint so do we not need the cast for the signed-to-unsigned conversion?
|
The total number of required reviews for this PR has been set to 2 based on the presence of this label: |
Please review this change that removes uses of checked_cast that are
unnecessary because they are tautological.
These were discovered by locally changing checked_cast to use the new
integer_cast for integral conversions, and noting which calls failed to
compile because of the anti-tautology check in the latter.
Testing: mach5 tier1
Progress
Errors
- [x] I confirm that I make this contribution in accordance with the [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/30482/head:pull/30482$ git checkout pull/30482Update a local copy of the PR:
$ git checkout pull/30482$ git pull https://git.openjdk.org/jdk.git pull/30482/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 30482View PR using the GUI difftool:
$ git pr show -t 30482Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/30482.diff
Using Webrev
Link to Webrev Comment