8149080: AArch64: Recognise disjoint array copy in stub code

Detect array copy can use fwd copy by checking (dest-src) above_same (copy_size)

Reviewed-by: aph
This commit is contained in:
Hui Shi 2016-02-05 03:55:51 -08:00
parent 9ad1ef5b10
commit 663e1a5c6d

View File

@ -792,6 +792,12 @@ class StubGenerator: public StubCodeGenerator {
assert_different_registers(s, d, count, rscratch1);
Label again, large, small;
const char *stub_name;
if (direction == copy_forwards)
stub_name = "foward_copy_longs";
else
stub_name = "backward_copy_longs";
StubCodeMark mark(this, "StubRoutines", stub_name);
__ align(CodeEntryAlignment);
__ bind(start);
__ cmp(count, 8);
@ -1160,8 +1166,11 @@ class StubGenerator: public StubCodeGenerator {
// caller can pass a 64-bit byte count here (from Unsafe.copyMemory)
BLOCK_COMMENT("Entry:");
}
__ cmp(d, s);
__ br(Assembler::LS, nooverlap_target);
// use fwd copy when (d-s) above_equal (count*size)
__ sub(rscratch1, d, s);
__ cmp(rscratch1, count, Assembler::LSL, exact_log2(size));
__ br(Assembler::HS, nooverlap_target);
if (is_oop) {
__ push(RegSet::of(d, count), sp);