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

Tobias Hartmann thartmann at openjdk.java.net
Wed Nov 25 08:23:58 UTC 2020


On Tue, 24 Nov 2020 23:43:56 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>> 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

Right, so `RegisterImpl::max_slots_per_register` which was introduced in JDK 9 by [JDK-8076276](https://bugs.openjdk.java.net/browse/JDK-8076276) does indeed not have any usages in current code. That explains why this was never an issue.

Your fix looks good to me.

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

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


More information about the hotspot-compiler-dev mailing list