5051 eor(rscratch1, a1, a2); 5052 cbz(rscratch1, SAME); 5053 // if (a==null || a2==null) 5054 // return false; 5055 cbz(a1, DONE); 5056 cbz(a2, DONE); 5057 // if (a1.length != a2.length) 5058 // return false; 5059 ldrw(cnt1, Address(a1, length_offset)); 5060 ldrw(cnt2, Address(a2, length_offset)); 5061 eorw(tmp1, cnt1, cnt2); 5062 cbnzw(tmp1, DONE); 5063 5064 lea(a1, Address(a1, base_offset)); 5065 lea(a2, Address(a2, base_offset)); 5066 } 5067 5068 // Check for short strings, i.e. smaller than wordSize. 5069 subs(cnt1, cnt1, elem_per_word); 5070 br(Assembler::LT, SHORT); 5071 // Main 8 byte comparison loop. 5072 bind(NEXT_WORD); { 5073 ldr(tmp1, Address(post(a1, wordSize))); 5074 ldr(tmp2, Address(post(a2, wordSize))); 5075 subs(cnt1, cnt1, elem_per_word); 5076 eor(tmp1, tmp1, tmp2); 5077 cbnz(tmp1, DONE); 5078 } br(GT, NEXT_WORD); 5079 // Last longword. In the case where length == 4 we compare the 5080 // same longword twice, but that's still faster than another 5081 // conditional branch. 5082 // cnt1 could be 0, -1, -2, -3, -4 for chars; -4 only happens when 5083 // length == 4. 5084 if (log_elem_size > 0) 5085 lsl(cnt1, cnt1, log_elem_size); 5086 ldr(tmp1, Address(a1, cnt1)); 5087 ldr(tmp2, Address(a2, cnt1)); 5088 eor(tmp1, tmp1, tmp2); 5089 cbnz(tmp1, DONE); 5090 b(SAME); | 5051 eor(rscratch1, a1, a2); 5052 cbz(rscratch1, SAME); 5053 // if (a==null || a2==null) 5054 // return false; 5055 cbz(a1, DONE); 5056 cbz(a2, DONE); 5057 // if (a1.length != a2.length) 5058 // return false; 5059 ldrw(cnt1, Address(a1, length_offset)); 5060 ldrw(cnt2, Address(a2, length_offset)); 5061 eorw(tmp1, cnt1, cnt2); 5062 cbnzw(tmp1, DONE); 5063 5064 lea(a1, Address(a1, base_offset)); 5065 lea(a2, Address(a2, base_offset)); 5066 } 5067 5068 // Check for short strings, i.e. smaller than wordSize. 5069 subs(cnt1, cnt1, elem_per_word); 5070 br(Assembler::LT, SHORT); 5071 // large loop algo should be used for >= 64(large loop) + 16(post loop) bytes 5072 cmp(cnt1, 80/elem_size); 5073 br(Assembler::LT, NEXT_WORD); 5074 RuntimeAddress stub = elem_size == 1 5075 ? RuntimeAddress(StubRoutines::aarch64::large_array_equals_byte()) 5076 : RuntimeAddress(StubRoutines::aarch64::large_array_equals_char()); 5077 assert(stub.target() != NULL, "array_equals_long_* stub has not been generated"); 5078 trampoline_call(stub); 5079 cbz(result, DONE); 5080 mov(result, false); // reset result 5081 // Main 8 byte comparison loop. 5082 bind(NEXT_WORD); { 5083 ldr(tmp1, Address(post(a1, wordSize))); 5084 ldr(tmp2, Address(post(a2, wordSize))); 5085 subs(cnt1, cnt1, elem_per_word); 5086 eor(tmp1, tmp1, tmp2); 5087 cbnz(tmp1, DONE); 5088 } br(GT, NEXT_WORD); 5089 // Last longword. In the case where length == 4 we compare the 5090 // same longword twice, but that's still faster than another 5091 // conditional branch. 5092 // cnt1 could be 0, -1, -2, -3, -4 for chars; -4 only happens when 5093 // length == 4. 5094 if (log_elem_size > 0) 5095 lsl(cnt1, cnt1, log_elem_size); 5096 ldr(tmp1, Address(a1, cnt1)); 5097 ldr(tmp2, Address(a2, cnt1)); 5098 eor(tmp1, tmp1, tmp2); 5099 cbnz(tmp1, DONE); 5100 b(SAME); |