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

Coleen Phillimore coleenp at openjdk.org
Tue Jun 27 23:03:03 UTC 2023


On Tue, 27 Jun 2023 20:48:27 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.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fixed the comment.

delta_as_int() could also be: delta2int()  ptrdelta2int() ptrdiff2int() ptrsub2int() in the theme of shorter names.
pointer_delta_as_int() ignoring it does something different than pointer_delta() (allows negative returns).
Change them all to check_cast<int>(a - b) - losing identifiable name
ptrdiff_cast(a - b) where int ptrdiff_cast(ptrdiff_t val) { return check<cast>(val); }

Brainstorming in a PR.  Your suggestions welcome.

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

PR Comment: https://git.openjdk.org/jdk/pull/14675#issuecomment-1610330128


More information about the hotspot-dev mailing list