RFR: 8311847: Fix -Wconversion for assembler.hpp emit_int8,16 callers

Dean Long dlong at openjdk.org
Tue Jul 11 02:59:12 UTC 2023


On Tue, 11 Jul 2023 01:26:44 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

> Please review changes to fix -Wconversion warnings that come from assembler_<cpu>.cpp by adding narrow_casts to the emit_int8,16,24, and 32 functions.  And some other fixups with checked_cast.
> 
> Ran tier1 on Oracle platforms, and tier1-4 on linux-x64-debug, linux-aarch64-debug, windows-x64-debug.

src/hotspot/share/asm/assembler.hpp line 305:

> 303: 
> 304: 
> 305:  public:

I don't think we need this.  See below.

src/hotspot/share/asm/assembler.hpp line 328:

> 326:                                                                                                  narrow_cast<uint8_t>(x2),
> 327:                                                                                                  narrow_cast<uint8_t>(x3),
> 328:                                                                                                  narrow_cast<uint8_t>(x4)); }

I'd rather add new alternative entry points for "int", so the existing callers using uint8_t don't need to perform unnecessary widening and narrowing.
Instead of narrow_cast<uint8_t>(x), how about (uint8_t)checked_cast<int8_t>(x)?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259116145
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259115553


More information about the hotspot-compiler-dev mailing list