[PATCH] Bug fix in TemplateTable::iop2 (JDK9 aarch32)

Andrey Petushkov andrey.petushkov at gmail.com
Tue Dec 29 17:33:55 UTC 2015


BTW, the 64-bit shifts are not that actually correct. The lshr gives wrong result for negative input since the ASR operation which is part of last ORR is destroying high bits of r0 by settings them to 1s when operand is negative. We’ve rewritten the method in the following way:
/***************code start***************/
void TemplateTable::lshr() {
   transition(itos, ltos);
   // shift count is in r0 - take shift from bottom six bits only
   __ andr(rscratch1, r0, 0x3f);
   __ pop_l(r2, r3);
   int word_bits = 8 * wordSize;
  <https://cherry.azulsystems.com/hg/zulu8-arm-dev/hotspot/rev/ee61e035baad#l3.89>
   __ lsr(r2, r2, rscratch1);
   __ rsb(r1, rscratch1, word_bits);
   __ orr(r0, r2, r3, lsl(r1));
   __ asr(r1, r3, rscratch1);
   __ subs(rscratch1, rscratch1, word_bits);
   __ orr(r0, r2, r3, asr(rscratch1), Assembler::GT);
}
/***************code end****************/

Unfortunately we did not yet pushed the previous work we’ve done so there is no changeset which could be applied directly into AArch32 port OpenJDK  codebase

Regards,
Andrey

> On 29 Dec 2015, at 20:26, Edward Nevill <edward.nevill at gmail.com> wrote:
> 
> Hi Xiang,
> 
> Thanks for finding this.
> 
> Interestingly, the 64 bit shifts were correct, but there were
> 
> // FIXME - Is this correct?
> 
> next to them. I have pushed your fix and removed the FIXMEs also.
> 
> This is one of those differences between C and Java that seems to crop up in every port.
> 
> All the best,
> Ed.
> 
> On Tue, 2015-12-29 at 21:21 +0800, Xiang Yuan wrote:
>> Hi, All:
>>  Our team fix a bug in JDK9 aarch32 template interpreter, the detail is
>> described below:
>> 
>> *Test Case:*
>> /***************code start***************/
>> public class Iop2 {
>>         public static void main(String args[]) {
>>                   int shift_bits = 36; //0x24, 0b00100100
>>                   int data = 0x87654321;
>> 
>>                   System.out.println(Integer.toHexString(data <<
>> shift_bits));
>>                   System.out.println(Integer.toHexString(data >>
>> shift_bits));
>>                   System.out.println(Integer.toHexString(data >>>
>> shift_bits));
>>         }
>> }
> 
> 



More information about the aarch32-port-dev mailing list