RFR: 8276563: Undefined Behaviour in class Assembler [v7]

Andrew Haley aph at openjdk.java.net
Wed Nov 17 14:23:40 UTC 2021


On Tue, 16 Nov 2021 18:04:32 GMT, Mai Đặng Quân Anh <duke at openjdk.java.net> wrote:

>> Andrew Haley has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Whitespace
>>  - Simplify and improve portability.
>
> src/hotspot/cpu/aarch64/register_aarch64.hpp line 154:
> 
>> 152: 
>> 153:   // derived registers, offsets, and addresses
>> 154:   FloatRegister successor() const { return as_FloatRegister((encoding() + 1) % 32); }
> 
> Should this `32` be replaced by `number_of_registers`. Furthermore, an `&` would save some instructions here, a `static_assert` to ensure `number_of_registers` is a power of 2, too.

I think I'll leave that optimization out, but I will change `32` to `number_of_registers`.

`successor()` is used only once in release code, it's not worth optimizing.
Also, that `% 32` is a kludge I'd like to get rid of, but this patch isn't supposed to affect anything but UB.

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

PR: https://git.openjdk.java.net/jdk/pull/6280


More information about the hotspot-compiler-dev mailing list