hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp
changeset 38028 be8cc044b136
parent 37269 5c2c4e5bb067
child 38037 31c22b526d30
equal deleted inserted replaced
38027:8a5693d27400 38028:be8cc044b136
  4668   // That's it.
  4668   // That's it.
  4669   bind(DONE);
  4669   bind(DONE);
  4670   BLOCK_COMMENT(is_string ? "} string_equals" : "} array_equals");
  4670   BLOCK_COMMENT(is_string ? "} string_equals" : "} array_equals");
  4671 }
  4671 }
  4672 
  4672 
       
  4673 // base:   Address of a buffer to be zeroed, 8 bytes aligned.
       
  4674 // cnt:    Count in 8-byte unit.
       
  4675 void MacroAssembler::zero_words(Register base, Register cnt)
       
  4676 {
       
  4677   fill_words(base, cnt, zr);
       
  4678 }
       
  4679 
       
  4680 // base:   Address of a buffer to be filled, 8 bytes aligned.
       
  4681 // cnt:    Count in 8-byte unit.
       
  4682 // value:  Value to be filled with.
       
  4683 // base will point to the end of the buffer after filling.
       
  4684 void MacroAssembler::fill_words(Register base, Register cnt, Register value)
       
  4685 {
       
  4686 //  Algorithm:
       
  4687 //
       
  4688 //    scratch1 = cnt & 7;
       
  4689 //    cnt -= scratch1;
       
  4690 //    p += scratch1;
       
  4691 //    switch (scratch1) {
       
  4692 //      do {
       
  4693 //        cnt -= 8;
       
  4694 //          p[-8] = v;
       
  4695 //        case 7:
       
  4696 //          p[-7] = v;
       
  4697 //        case 6:
       
  4698 //          p[-6] = v;
       
  4699 //          // ...
       
  4700 //        case 1:
       
  4701 //          p[-1] = v;
       
  4702 //        case 0:
       
  4703 //          p += 8;
       
  4704 //      } while (cnt);
       
  4705 //    }
       
  4706 
       
  4707   assert_different_registers(base, cnt, value, rscratch1, rscratch2);
       
  4708 
       
  4709   Label entry, loop;
       
  4710   const int unroll = 8; // Number of str instructions we'll unroll
       
  4711 
       
  4712   andr(rscratch1, cnt, unroll - 1);  // tmp1 = cnt % unroll
       
  4713   cbz(rscratch1, entry);
       
  4714   sub(cnt, cnt, rscratch1);          // cnt -= tmp1
       
  4715   // base always points to the end of the region we're about to fill
       
  4716   add(base, base, rscratch1, Assembler::LSL, 3);
       
  4717   adr(rscratch2, entry);
       
  4718   sub(rscratch2, rscratch2, rscratch1, Assembler::LSL, 2);
       
  4719   br(rscratch2);
       
  4720   bind(loop);
       
  4721   add(base, base, unroll * 8);
       
  4722   sub(cnt, cnt, unroll);
       
  4723   for (int i = -unroll; i < 0; i++)
       
  4724     str(value, Address(base, i * 8));
       
  4725   bind(entry);
       
  4726   cbnz(cnt, loop);
       
  4727 }
  4673 
  4728 
  4674 // encode char[] to byte[] in ISO_8859_1
  4729 // encode char[] to byte[] in ISO_8859_1
  4675 void MacroAssembler::encode_iso_array(Register src, Register dst,
  4730 void MacroAssembler::encode_iso_array(Register src, Register dst,
  4676                       Register len, Register result,
  4731                       Register len, Register result,
  4677                       FloatRegister Vtmp1, FloatRegister Vtmp2,
  4732                       FloatRegister Vtmp1, FloatRegister Vtmp2,