< prev index next >

src/cpu/aarch64/vm/macroAssembler_aarch64.cpp

Print this page
rev 10083 : 8149100: AArch64: "bad AD file" for LL enconding AryEq Node matching
Summary: add byte array equal support for aarch64
Reviewed-by: duke


4540   cbz(cnt, SAME_CHARS);
4541 
4542   bind(SHORT_LOOP);
4543   load_unsigned_short(tmp1, Address(post(str1, 2)));
4544   load_unsigned_short(tmp2, Address(post(str2, 2)));
4545   subw(tmp1, tmp1, tmp2);
4546   cbnz(tmp1, DONE);
4547   sub(cnt, cnt, 1);
4548   cbnz(cnt, SHORT_LOOP);
4549 
4550   // Strings are equal.
4551   bind(SAME_CHARS);
4552   mov(result, true);
4553 
4554   // That's it
4555   bind(DONE);
4556 
4557   BLOCK_COMMENT("} string_equals");
4558 }
4559 












































































4560 // Compare char[] arrays aligned to 4 bytes
4561 void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
4562                                         Register result, Register tmp1)
4563 {
4564   Register cnt1 = rscratch1;
4565   Register cnt2 = rscratch2;
4566   Register tmp2 = rscratch2;
4567 
4568   Label SAME, DIFFER, NEXT, TAIL03, TAIL01;
4569 
4570   int length_offset  = arrayOopDesc::length_offset_in_bytes();
4571   int base_offset    = arrayOopDesc::base_offset_in_bytes(T_CHAR);
4572 
4573   BLOCK_COMMENT("char_arrays_equals  {");
4574 
4575     // different until proven equal
4576     mov(result, false);
4577 
4578     // same array?
4579     cmp(ary1, ary2);




4540   cbz(cnt, SAME_CHARS);
4541 
4542   bind(SHORT_LOOP);
4543   load_unsigned_short(tmp1, Address(post(str1, 2)));
4544   load_unsigned_short(tmp2, Address(post(str2, 2)));
4545   subw(tmp1, tmp1, tmp2);
4546   cbnz(tmp1, DONE);
4547   sub(cnt, cnt, 1);
4548   cbnz(cnt, SHORT_LOOP);
4549 
4550   // Strings are equal.
4551   bind(SAME_CHARS);
4552   mov(result, true);
4553 
4554   // That's it
4555   bind(DONE);
4556 
4557   BLOCK_COMMENT("} string_equals");
4558 }
4559 
4560 
4561 void MacroAssembler::byte_arrays_equals(Register ary1, Register ary2,
4562                                         Register result, Register tmp1)
4563 {
4564   Register cnt1 = rscratch1;
4565   Register cnt2 = rscratch2;
4566   Register tmp2 = rscratch2;
4567 
4568   Label SAME, DIFFER, NEXT, TAIL07, TAIL03, TAIL01;
4569 
4570   int length_offset  = arrayOopDesc::length_offset_in_bytes();
4571   int base_offset    = arrayOopDesc::base_offset_in_bytes(T_BYTE);
4572 
4573   BLOCK_COMMENT("byte_arrays_equals  {");
4574 
4575     // different until proven equal
4576     mov(result, false);
4577 
4578     // same array?
4579     cmp(ary1, ary2);
4580     br(Assembler::EQ, SAME);
4581 
4582     // ne if either null
4583     cbz(ary1, DIFFER);
4584     cbz(ary2, DIFFER);
4585 
4586     // lengths ne?
4587     ldrw(cnt1, Address(ary1, length_offset));
4588     ldrw(cnt2, Address(ary2, length_offset));
4589     cmp(cnt1, cnt2);
4590     br(Assembler::NE, DIFFER);
4591 
4592     lea(ary1, Address(ary1, base_offset));
4593     lea(ary2, Address(ary2, base_offset));
4594 
4595     subs(cnt1, cnt1, 8);
4596     br(LT, TAIL07);
4597 
4598   BIND(NEXT);
4599     ldr(tmp1, Address(post(ary1, 8)));
4600     ldr(tmp2, Address(post(ary2, 8)));
4601     subs(cnt1, cnt1, 8);
4602     eor(tmp1, tmp1, tmp2);
4603     cbnz(tmp1, DIFFER);
4604     br(GE, NEXT);
4605 
4606   BIND(TAIL07);  // 0-7 bytes left, cnt1 = #bytes left - 4
4607     tst(cnt1, 0b100);
4608     br(EQ, TAIL03);
4609     ldrw(tmp1, Address(post(ary1, 4)));
4610     ldrw(tmp2, Address(post(ary2, 4)));
4611     cmp(tmp1, tmp2);
4612     br(NE, DIFFER);
4613 
4614   BIND(TAIL03);  // 0-3 bytes left, cnt1 = #bytes left - 4
4615     tst(cnt1, 0b10);
4616     br(EQ, TAIL01);
4617     ldrh(tmp1, Address(post(ary1, 2)));
4618     ldrh(tmp2, Address(post(ary2, 2)));
4619     cmp(tmp1, tmp2);
4620     br(NE, DIFFER);
4621   BIND(TAIL01);  // 0-1 byte left
4622     tst(cnt1, 0b01);
4623     br(EQ, SAME);
4624     ldrb(tmp1, ary1);
4625     ldrb(tmp2, ary2);
4626     cmp(tmp1, tmp2);
4627     br(NE, DIFFER);
4628 
4629   BIND(SAME);
4630     mov(result, true);
4631   BIND(DIFFER); // result already set
4632 
4633   BLOCK_COMMENT("} byte_arrays_equals");
4634 }
4635 
4636 // Compare char[] arrays aligned to 4 bytes
4637 void MacroAssembler::char_arrays_equals(Register ary1, Register ary2,
4638                                         Register result, Register tmp1)
4639 {
4640   Register cnt1 = rscratch1;
4641   Register cnt2 = rscratch2;
4642   Register tmp2 = rscratch2;
4643 
4644   Label SAME, DIFFER, NEXT, TAIL03, TAIL01;
4645 
4646   int length_offset  = arrayOopDesc::length_offset_in_bytes();
4647   int base_offset    = arrayOopDesc::base_offset_in_bytes(T_CHAR);
4648 
4649   BLOCK_COMMENT("char_arrays_equals  {");
4650 
4651     // different until proven equal
4652     mov(result, false);
4653 
4654     // same array?
4655     cmp(ary1, ary2);


< prev index next >