8215100: AArch64: fix compareTo intrinsic with four-character Latin/Unicode
authoraph
Thu, 20 Dec 2018 17:07:07 +0000
changeset 53089 147e2d96748d
parent 53088 a682cf219811
child 53090 759266b1c89b
8215100: AArch64: fix compareTo intrinsic with four-character Latin/Unicode Reviewed-by: aph, dpochepk Contributed-by: nick.gasson@arm.com
src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Dec 20 17:29:59 2018 +0100
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Dec 20 17:07:07 2018 +0000
@@ -4896,7 +4896,7 @@
 
   // A very short string
   cmpw(cnt2, minCharsInWord);
-  br(Assembler::LT, SHORT_STRING);
+  br(Assembler::LE, SHORT_STRING);
 
   // Compare longwords
   // load first parts of strings and finish initialization while loading
@@ -4920,8 +4920,7 @@
       ldr(tmp2, Address(str2));
       cmp(cnt2, STUB_THRESHOLD);
       br(GE, STUB);
-      subsw(cnt2, cnt2, 4);
-      br(EQ, TAIL_CHECK);
+      subw(cnt2, cnt2, 4);
       eor(vtmpZ, T16B, vtmpZ, vtmpZ);
       lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
       lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
@@ -4937,8 +4936,7 @@
       ldrs(vtmp, Address(str2));
       cmp(cnt2, STUB_THRESHOLD);
       br(GE, STUB);
-      subsw(cnt2, cnt2, 4);
-      br(EQ, TAIL_CHECK);
+      subw(cnt2, cnt2, 4);
       lea(str1, Address(str1, cnt2, Address::uxtw(str1_chr_shift)));
       eor(vtmpZ, T16B, vtmpZ, vtmpZ);
       lea(str2, Address(str2, cnt2, Address::uxtw(str2_chr_shift)));
--- a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java	Thu Dec 20 17:29:59 2018 +0100
+++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics2.java	Thu Dec 20 17:07:07 2018 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -642,6 +642,12 @@
             assertEquals(-3, asmStringCompareTo(a2, b2),
                          "TestOther.asmStringCompareTo(very_very_long_strings_2)");
         }
+
+        // See bug 8215100
+        {
+            assertEquals(-20, asmStringCompareTo("e.\u0259.", "y.e."));
+            assertEquals(20, asmStringCompareTo("y.e.", "e.\u0259."));
+        }
     }