8149080: AArch64: Recognise disjoint array copy in stub code
Summary: Detect array copy can use fwd copy by checking (dest-src) above_same (copy_size)
Reviewed-by: aph
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Sat Feb 06 04:09:47 2016 -0800
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp Fri Feb 05 03:55:51 2016 -0800
@@ -792,6 +792,12 @@
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 @@
// 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);