RFR(S): 8080190: PPC64: Fix wrong rotate instructions in the .ad file

Vladimir Kozlov vladimir.kozlov at oracle.com
Wed May 13 18:39:05 UTC 2015


Is this because you can have negative values?
I see that at the bottom of calls which generate bits u_field() method 
is used. Why not mask it there?

There are other instructions which can have the same problem (slwi). You 
would have to guarantee all of those do the masking. That is why I am 
asking why not mask it at the final code methods, like u_field()?

Thanks,
Vladimir

On 5/13/15 9:29 AM, Volker Simonis wrote:
> Hi,
>
> could you please review the following, ppc64-only fix which solves a
> problem with the integer-rotate instructions in C2:
>
> https://bugs.openjdk.java.net/browse/JDK-8080190
> http://cr.openjdk.java.net/~simonis/webrevs/2015/8080190.v2/
>
> The problem was that we initially took the "rotate left/right by 8-bit
> immediate" instructions from x86_64. But on x86_64 the rotate
> instructions for 32-bit integers do in fact really take 8-bit
> immediates (seems like the Intel guys had to many spare bits when they
> designed their instruction set :) On the other hand, the rotate
> instructions on Power only use 5 bit to encode the rotation distance.
>
> We do check for this limit, but only in the debug build so you'll see
> an assertion there, but in the product build we will silently emit a
> wrong instruction which can lead to anything starting from a crash up
> to an incorrect computation.
>
> I think the simplest solution for this problem is to mask the
> rotation distance with 0x1f  (which is equivalent to taking the
> distance modulo 32) in the corresponding instructions.
>
> This change should also be backported to 8 as fast as possible. Notice
> that this a day-zero bug in our ppc64 port because in our internal SAP
> JVM we already mask the shift amounts in the ideal graph but for some
> unknown reasons these shared changes haven’t been contributed along
> with our port.
>
> Thank you and best regards,
> Volker
>


More information about the hotspot-compiler-dev mailing list