RFR: 8256956: RegisterImpl::max_slots_per_register is incorrect on AMD64

Jie Fu jiefu at openjdk.java.net
Tue Nov 24 23:46:56 UTC 2020


On Tue, 24 Nov 2020 17:43:53 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>>> Just wondering, is that value even used? I did a quick search and couldn't find any usages.
>> 
>> When I grep for `ConcreteRegisterImpl::number_of_registers`, it seems to have quite a few hits in x86 and shared code.
>
> Indeed. I've searched for the wrong value.

Hi @TobiHartmann and @shipilev ,

Thanks for looking at this.

The wrong value really confused me while I was trying to understand the code.

Before this fix, RegisterImpl::max_slots_per_register seems not to be used directly on x86.
That may be why the bug didn't get exposed before.

I've notice that RegisterImpl::max_slots_per_register is used to calculate the value of ConcreteRegisterImpl::number_of_registers in aarch64 [1].
So I think it a good idea to use it in x86 to eliminate '#ifdef AMD64' [2], which seems to improve the readability of the code.

What do you think?

Thanks.
Best regards, 
Jie

[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/aarch64/register_aarch64.hpp#L295
[2] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/register_x86.hpp#L260

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

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


More information about the hotspot-compiler-dev mailing list