RFR: 8310906: Fix -Wconversion warnings in runtime, oops and some code header files. [v2]
Coleen Phillimore
coleenp at openjdk.org
Tue Jun 27 15:16:28 UTC 2023
On Tue, 27 Jun 2023 14:54:03 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> 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?
>
> Hm. Maybe this would be ok. Our original idea was to make it T* not T until this cast. I don't know how many other cases there are that I haven't gotten to yet. But it would eliminate a cast, so that's good (unless these aren't the same). Some instances have ptr - constant that gets promoted I think.
> The reason we didn't pick pointer_delta_as_int because pointer_delta has different semantics. pointer_delta insists on positive results.
Taking out that cast does work, so I've fixed that.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14675#discussion_r1243922324
More information about the hotspot-dev
mailing list