[aarch64-port-dev ] RFR: 8148328: aarch64: avoid unnecessary lsr instructions in stub code

Andrew Haley aph at redhat.com
Wed Jan 27 13:45:16 UTC 2016


On 01/27/2016 11:47 AM, Felix Yang wrote:

> Please review the following webrev:
> http://cr.openjdk.java.net/~fyang/8148328/webrev.00/
> 
> Jira issue: https://bugs.openjdk.java.net/browse/JDK-8148328
> 
> This trivial patch eliminates unnecessary lsr instructions in
> jbyte_arraycopy and jbyte_disjoint_arraycopy stub.
> 
> Tested with jtreg hotspot & langtools.  Is it OK?

OK, except that this is C++ so we can declare shift when it is defined:

diff --git a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
--- a/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
+++ b/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp
@@ -962,7 +962,7 @@
       __ lea(d, Address(d, count, Address::lsl(exact_log2(-step))));
     }

-    Label done, tail;
+    Label tail;

     __ cmp(count, 16/granularity);
     __ br(Assembler::LO, tail);
@@ -987,7 +987,8 @@
       }
       // rscratch2 is the byte adjustment needed to align s.
       __ cbz(rscratch2, aligned);
-      __ lsr(rscratch2, rscratch2, exact_log2(granularity));
+      int shift = exact_log2(granularity);
+      if (shift)  __ lsr(rscratch2, rscratch2, shift);
       __ sub(count, count, rscratch2);

 #if 0

Andrew.



More information about the aarch64-port-dev mailing list