RFR: 8309685: Fix -Wconversion warnings in assembler and register code [v3]
Dean Long
dlong at openjdk.org
Wed Jun 14 18:20:58 UTC 2023
On Wed, 14 Jun 2023 12:47:51 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> This change widens some int arguments, narrows some int returns and adds some casts and checked_casts where the compiler was doing the implicit conversion. I maintained existing types - ie if the parameter was short, I used a cast to short. Also int is used in places that might be better served as unsigned int but I didn't fix that because it would be too large and risky. The registers encode an offset in an array, so it's safe to checked_cast<> to get their encoding. This fix is limited so that the types changed and casts added are intentional.
>> See CR for counts of -Wconversion warnings this resolves.
>> Tested with tier1-7, also tested with tier1 on all Oracle supported platforms.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>
> Happy to add riscv, thanks.
src/hotspot/share/utilities/globalDefinitions.hpp line 530:
> 528: #endif
> 529: return static_cast<T2>(thing);
> 530: }
I don't understand this change. Isn't it confusing to treat unsigned types as signed here? Unsigned types don't sign extend. If emit_intXX can take signed values then shouldn't that be reflected in the types of the arguements?
Also, -max should be -max - 1 for 2's complement, right?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14396#discussion_r1230002701
More information about the hotspot-dev
mailing list