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

Stefan Karlsson stefank at openjdk.org
Tue Jun 27 13:31:11 UTC 2023


On Tue, 27 Jun 2023 12:41:50 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> This is another version of PR https://github.com/openjdk/jdk/pull/14659 but I've added a pointer delta function in globalDefinitions.hpp to use for these pointer diff calculations that return int everywhere.  If the name is agreeable, I'll fix the other cases of this like this.  It's better than raw casts.
> Tested with tier1-4.

src/hotspot/share/code/codeBlob.inline.hpp line 36:

> 34: inline const ImmutableOopMap* CodeBlob::oop_map_for_slot(int slot, address return_address) const {
> 35:   assert(_oop_maps != nullptr, "nope");
> 36:   return _oop_maps->find_map_at_slot(slot, delta_as_int((intptr_t) return_address, (intptr_t) code_begin()));

Is this the only usage of `delta_as_int` that operates on `intptr_t`? If we remove the casts then all usages would operate on pointers. Maybe this is an indication that we only need a `pointer_delta_as_int` function, to go hand in hand with the other `pointer_delta` functions?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14675#discussion_r1243696287


More information about the hotspot-dev mailing list