RFR: 8187472 - AARCH64: array_equals intrinsic doesn't use prefetch for large arrays

Andrew Haley aph at redhat.com
Thu Feb 8 09:54:40 UTC 2018

On 07/02/18 19:39, Dmitrij Pochepko wrote:
> Note: medium sizes are a bit slower because of additional branch 
> added(which checks size and jumps to stub).

The indentation is messed up here:

@@ -5201,40 +5217,23 @@
   // length == 4.
   if (log_elem_size > 0)
     lsl(cnt1, cnt1, log_elem_size);
-  ldr(tmp1, Address(a1, cnt1));
-  ldr(tmp2, Address(a2, cnt1));
+    ldr(tmp1, Address(a1, cnt1));
+    ldr(tmp2, Address(a2, cnt1));
   eor(tmp1, tmp1, tmp2);
   cbnz(tmp1, DONE);

This pessimizes a very common case of string comparisons, those of
about 32 bytes.  Please think again.

I'm not convinced that reading beyond the end of the memory you're
passed is always safe.  What if you're passed an address which is the
last three bytes in a region?  It's not good enough to say that
HotSpot doesn't do that today: maybe not, but one day it might.

Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671

More information about the hotspot-compiler-dev mailing list