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

2023-06-27 Thread Coleen Phillimore
On Tue, 27 Jun 2023 14:54:03 GMT, Coleen Phillimore  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


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

2023-06-27 Thread Coleen Phillimore
> 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.

Coleen Phillimore has updated the pull request incrementally with one 
additional commit since the last revision:

  Make delta_as_int take pointers and fix cast.  Missed one in 
stubCodeGenerator.hpp

-

Changes:
  - all: https://git.openjdk.org/jdk/pull/14675/files
  - new: https://git.openjdk.org/jdk/pull/14675/files/9b7fdef2..99a15d6e

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk=14675=01
 - incr: https://webrevs.openjdk.org/?repo=jdk=14675=00-01

  Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/14675.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14675/head:pull/14675

PR: https://git.openjdk.org/jdk/pull/14675