4674 // call indirectly to solve generation ordering problem |
4674 // call indirectly to solve generation ordering problem |
4675 AddressLiteral base(Universe::narrow_oop_base_addr()); |
4675 AddressLiteral base(Universe::narrow_oop_base_addr()); |
4676 load_ptr_contents(base, G6_heapbase); |
4676 load_ptr_contents(base, G6_heapbase); |
4677 } |
4677 } |
4678 } |
4678 } |
|
4679 |
|
4680 // Compare char[] arrays aligned to 4 bytes. |
|
4681 void MacroAssembler::char_arrays_equals(Register ary1, Register ary2, |
|
4682 Register limit, Register result, |
|
4683 Register chr1, Register chr2, Label& Ldone) { |
|
4684 Label Lvector, Lloop; |
|
4685 assert(chr1 == result, "should be the same"); |
|
4686 |
|
4687 // Note: limit contains number of bytes (2*char_elements) != 0. |
|
4688 andcc(limit, 0x2, chr1); // trailing character ? |
|
4689 br(Assembler::zero, false, Assembler::pt, Lvector); |
|
4690 delayed()->nop(); |
|
4691 |
|
4692 // compare the trailing char |
|
4693 sub(limit, sizeof(jchar), limit); |
|
4694 lduh(ary1, limit, chr1); |
|
4695 lduh(ary2, limit, chr2); |
|
4696 cmp(chr1, chr2); |
|
4697 br(Assembler::notEqual, true, Assembler::pt, Ldone); |
|
4698 delayed()->mov(G0, result); // not equal |
|
4699 |
|
4700 // only one char ? |
|
4701 br_on_reg_cond(rc_z, true, Assembler::pn, limit, Ldone); |
|
4702 delayed()->add(G0, 1, result); // zero-length arrays are equal |
|
4703 |
|
4704 // word by word compare, dont't need alignment check |
|
4705 bind(Lvector); |
|
4706 // Shift ary1 and ary2 to the end of the arrays, negate limit |
|
4707 add(ary1, limit, ary1); |
|
4708 add(ary2, limit, ary2); |
|
4709 neg(limit, limit); |
|
4710 |
|
4711 lduw(ary1, limit, chr1); |
|
4712 bind(Lloop); |
|
4713 lduw(ary2, limit, chr2); |
|
4714 cmp(chr1, chr2); |
|
4715 br(Assembler::notEqual, true, Assembler::pt, Ldone); |
|
4716 delayed()->mov(G0, result); // not equal |
|
4717 inccc(limit, 2*sizeof(jchar)); |
|
4718 // annul LDUW if branch is not taken to prevent access past end of array |
|
4719 br(Assembler::notZero, true, Assembler::pt, Lloop); |
|
4720 delayed()->lduw(ary1, limit, chr1); // hoisted |
|
4721 |
|
4722 // Caller should set it: |
|
4723 // add(G0, 1, result); // equals |
|
4724 } |
|
4725 |