RFR: 8313785: Fix -Wconversion warnings in prims code
Dean Long
dlong at openjdk.org
Fri Aug 4 22:22:31 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/methodHandles.cpp line 910:
> 908: InstanceKlass* defc = InstanceKlass::cast(java_lang_Class::as_Klass(clazz));
> 909: DEBUG_ONLY(clazz = nullptr); // safety
> 910: intptr_t vmindex = java_lang_invoke_MemberName::vmindex(mname());
Why not do the checked_cast<int> here instead of below?
Ideally, the vmindex field would be changed to int (field offsets, itable/vtable indexes are all int), but that's more work.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15160#discussion_r1284883812
More information about the serviceability-dev
mailing list