RFR: 8313785: Fix -Wconversion warnings in prims code

Serguei Spitsyn sspitsyn at openjdk.org
Fri Aug 4 18:13:30 UTC 2023


On Fri, 4 Aug 2023 14:37:07 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> This patch fixes Wconversion in code in the src/hotspot/share/prims directory.  Most of the changes correct the types.  jfieldID's are created with the int offset returned by InstanceKlass::field_offset().
>      int     field_offset      (int index) const { return field(index).offset(); }
> 
> So when we get the field offset back, it's an int.
> 
> Also stackwalker passes jlong, so made that consistent.
> 
> Tested with tier1 on Oracle supported platforms.

Looks good.
Thanks,
Serguei

src/hotspot/share/prims/unsafe.cpp line 111:

> 109: }
> 110: 
> 111: static inline int field_offset_from_byte_offset(int byte_offset) {

Nit: I wonder if the same fix is needed for the previous function at line 107 to make it consistent.
       But I guess there is no warning related to it.

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15160#pullrequestreview-1563348546
PR Review Comment: https://git.openjdk.org/jdk/pull/15160#discussion_r1284714469


More information about the serviceability-dev mailing list