RFR: 8308396: Fix offset_of conversion warnings in runtime code

Amit Kumar amitkumar at openjdk.org
Fri May 19 05:01:57 UTC 2023

On Thu, 18 May 2023 22:37:57 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Please review this change to use ByteSize and byte_offset_of() to refer to offsets to metadata and other types that are used in generated code.  This avoids the int narrowing conversion warning for -Wconversion.  There were a couple that I just added an (int) cast instead because these offsets are either being used in other code currently being changed (in oopDesc) or there are too many (like displaced_header_offset_in_bytes) and should be their own change.
> This change takes a  chunk out of the -Wconversion warnings - see CR for more info.
> It might be easier and less tedious to review the commits separately.  One commit renames blah_offset_in_bytes to blah_offset, since in_bytes(blah_offset()) is typically used (except in Address constructor which has an overload for ByteSize).
> Tested with tier1-4, x86 and aarch64, and built linux-x64-zero linux-x64-zero-debug linux-aarch64-debug linux-s390x-open linux-arm32-debug linux-ppc64le-debug linux-riscv64-debug locally.

Testing for fastdebug build/ tier1 tests looks good on s390x.

I've given my suggestion for fixing the build-break, but I leave that upto you :-)

src/hotspot/cpu/s390/sharedRuntime_s390.cpp line 2781:

> 2779:   assert(Immediate::is_uimm8(Deoptimization::Unpack_LIMIT), "Code not fit for larger immediates");
> 2780:   assert(Immediate::is_uimm8(Deoptimization::Unpack_uncommon_trap), "Code not fit for larger immediates");
> 2781:   const int unpack_kind_byte_offset = Deoptimization::UnrollBlock::unpack_kind_offset()


  const int unpack_kind_byte_offset = in_bytes(Deoptimization::UnrollBlock::unpack_kind_offset())


Marked as reviewed by amitkumar (Author).

PR Review: https://git.openjdk.org/jdk/pull/14053#pullrequestreview-1433773874
PR Review Comment: https://git.openjdk.org/jdk/pull/14053#discussion_r1198543159

More information about the graal-dev mailing list