RFR: 8308396: Fix offset_of conversion warnings in runtime code

Coleen Phillimore coleenp at openjdk.org
Thu May 18 22:45:04 UTC 2023

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.


Commit messages:
 - Change ObjectMonitor offset to return ByteSize
 - Restore warnings are errors.
 - Rename blah_in_bytes to blah because now the functions return ByteSize which require in_bytes() to get to int.
 - Change offset_of to byte_offset_of returning ByteSize for most cases, or add int cast in the cases where too much code downstream does arithmetic with the offset.

Changes: https://git.openjdk.org/jdk/pull/14053/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=14053&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8308396
  Stats: 447 lines in 85 files changed: 11 ins; 9 del; 427 mod
  Patch: https://git.openjdk.org/jdk/pull/14053.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/14053/head:pull/14053

PR: https://git.openjdk.org/jdk/pull/14053

More information about the graal-dev mailing list