RFR: 8309685: Fix -Wconversion warnings in assembler and register code
Coleen Phillimore
coleenp at openjdk.org
Tue Jun 13 15:55:50 UTC 2023
On Tue, 13 Jun 2023 14:37:36 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> Thanks for the suggested change. The sign extension for integral promotion was a problem. The second emit_int8 will still assert for the callers (there are still some) that pass a type that gets sign extended to int to emit_in8. I can see how many are left once the first function is added. Maybe it's possible to fix them all. We'll see.
>
> src/hotspot/cpu/x86/assembler_x86.cpp|4421 col 12| error: no matching function for call to 'Assembler::emit_int8(Assembler::ComparisonPredicate&)'
> || 4421 | emit_int8(vcc);
> || | ~~~~~~~~~^~~~~
> || In file included from /scratch/cphillim/hg/21more-conversion/src/hotspot/cpu/x86/assembler_x86.cpp:26:
>
> But I made ComparisonPredicate enum a uint8_t. Why didn't it match it?
>
> // Comparison predicates for integral types & FP types when using SSE
> enum ComparisonPredicate : uint8_t {
>
> There are a bunch of these that don't like the templates.
Taking out the ENABLE_IF<is_integral> at least allows it to compile but there are lots of crashes because of sign extension.
Maybe we can make checked_cast<> tolerant of that somehow?
```template <typename T2, typename T1>
constexpr T2 checked_cast(T1 thing) {
T2 result = static_cast<T2>(thing);
assert(static_cast<T1>(result) == thing, "must be");
return result;
}```
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14396#discussion_r1228362727
More information about the hotspot-dev
mailing list