RFR: 8311847: Fix -Wconversion for assembler.hpp emit_int8,16 callers
Coleen Phillimore
coleenp at openjdk.org
Tue Jul 11 15:01:10 UTC 2023
On Tue, 11 Jul 2023 12:51:27 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/cpu/aarch64/assembler_aarch64.hpp line 224:
>>
>>> 222: unsigned target = *(unsigned *)a;
>>> 223: target &= ~mask;
>>> 224: target |= checked_cast<unsigned>(val);
>>
>> Any value that doesn't fit in 32 bits is going to fail, so it's tempting to force the callers to pass 32-bit types, but that's a bigger change. How about something like this:
>>
>> static ALWAYSINLINE void patch(address a, int msb, int lsb, uint32_t val) {
>> /* original code, no additional checked_cast needed */
>> }
>>
>> static ALWAYSINLINE void patch(address a, int msb, int lsb, uint64_t val) {
>> patch(a, msb, lsb, checked_cast<unsigned>(val));
>> }
>
> I'll try this suggestion.
src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp:614:35: error: call to 'patch' is ambiguous
[2023-07-11T14:00:01,568Z] void set_kind(int order_kind) { Instruction_aarch64::patch(addr_at(0), 11, 8, order_kind); }
[2023-07-11T14:00:01,568Z] ^~~~~~~~~~~~~~~~~~~~~~~~~~
The compiler thinks its ambiguous.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/14822#discussion_r1259869970
More information about the hotspot-dev
mailing list