RFR: 8313785: Fix -Wconversion warnings in prims code
Dean Long
dlong at openjdk.org
Fri Aug 4 21:58:29 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.
src/hotspot/share/prims/jni.cpp line 1906:
> 1904: o = JvmtiExport::jni_SetField_probe(thread, obj, o, k, fieldID, false, SigType, (jvalue *)&field_value); \
> 1905: } \
> 1906: if (SigType == JVM_SIGNATURE_BOOLEAN) { value = (Argument)(((jboolean)value) & 1); } \
This is already done in bool_field_put(), so it is redundant here. I think it can be safely removed.
src/hotspot/share/prims/jni.cpp line 2099:
> 2097: JvmtiExport::jni_SetField_probe(thread, nullptr, nullptr, id->holder(), fieldID, true, SigType, (jvalue *)&field_value); \
> 2098: } \
> 2099: if (SigType == JVM_SIGNATURE_BOOLEAN) { value = (Argument)(((jboolean)value) & 1); } \
Same as above.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15160#discussion_r1284873690
PR Review Comment: https://git.openjdk.org/jdk/pull/15160#discussion_r1284873793
More information about the hotspot-dev
mailing list