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

Coleen Phillimore coleenp at openjdk.org
Mon Jun 26 21:35:11 UTC 2023


On Mon, 26 Jun 2023 17:47:25 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> 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.

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);
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14659#issuecomment-1608292000


More information about the serviceability-dev mailing list