Skip to content
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

8310906: Fix -Wconversion warnings in runtime, oops and some code header files. #14659

Closed
wants to merge 1 commit into from

Conversation

coleenp
Copy link
Contributor

@coleenp coleenp commented Jun 26, 2023

More casts for size of address differences in same code space, checked_casts<> and type changes to fix -Wconversion warnings. See CR for details.
Tested with tier1-4.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8310906: Fix -Wconversion warnings in runtime, oops and some code header files. (Enhancement - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/14659/head:pull/14659
$ git checkout pull/14659

Update a local copy of the PR:
$ git checkout pull/14659
$ git pull https://git.openjdk.org/jdk.git pull/14659/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 14659

View PR using the GUI difftool:
$ git pr show -t 14659

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/14659.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 26, 2023

👋 Welcome back coleenp! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 26, 2023
@openjdk
Copy link

openjdk bot commented Jun 26, 2023

@coleenp The following labels will be automatically applied to this pull request:

  • hotspot
  • serviceability

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.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org labels Jun 26, 2023
@mlbridge
Copy link

mlbridge bot commented Jun 26, 2023

Webrevs

@@ -217,7 +217,7 @@ template<typename FKind> frame ThawBase::new_stack_frame(const frame& hf, frame&
intptr_t* heap_sp = hf.unextended_sp();
// If caller is interpreted it already made room for the callee arguments
int overlap = caller.is_interpreted_frame() ? ContinuationHelper::InterpretedFrame::stack_argsize(hf) : 0;
const int fsize = ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp() - overlap;
const int fsize = checked_cast<int>(ContinuationHelper::InterpretedFrame::frame_bottom(hf) - hf.unextended_sp() - overlap);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line computes the size of the unextended frame minus the overlap that exists if the callee is using arguments in the caller’s frame. So this value is lower or equal to the frame’ size which is encoded with an int. I don't think a checked_cast is required here. This applies to the x86 version too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll make this change in the new PR. I'm going to redo the address calculations to call a function rather than the casts.

@coleenp
Copy link
Contributor Author

coleenp commented Jun 26, 2023

After some offline conversation with Ioi, we thought of a better way to express these pointer subtractions returning int, so I'm going to close this PR and open a new one with at least these changed with that new function.

// delta usually called with pointers or intptr_t that returns an int
// used for code buffer and other nearby address calculations.
// This allows the left side to be less than the right side.
template <typename T>
inline int delta_as_int(const volatile T left, const volatile T right) {
  return checked_cast<int>(left - right);
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot hotspot-dev@openjdk.org rfr Pull request is ready for review serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

2 participants