RFR: 8311847: Fix -Wconversion for assembler.hpp emit_int8,16 callers
Coleen Phillimore
coleenp at openjdk.org
Tue Jul 11 12:59:07 UTC 2023
On Tue, 11 Jul 2023 12:29:09 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> uint64_t uval64 = val;
>> unsigned uval = checked_cast<unsigned>(uval64);
>> This won't work for negative values, right?
>
> val comes in signed, so we want to just chop off the sign. checked_cast<unsigned>(signed val) will assert. checked_cast<> doesn't do sign conversion. We don't have a cast that does sign conversion.
Not sure I trust this either. I'm going to write a gtest for this.
>> How many callers are passing in negative values and actually need these convenience functions?
>
> The overloading was really unhappy with the version of the functions that pass uint8_t for all the arguments. The callers might pass a couple uint8_t but then also a random selection of int and for one or more of the other parameters.
> How many callers?
Actually quite a lot for the emit_int16/24/32 ones. They pass an int imm8 value and have some (value | encode) parameter where encode is an int passed in.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259682829
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259685864
More information about the hotspot-compiler-dev
mailing list