JDK-8196710 : Intrinsify new StringLatin1/StringUTF16 methods
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2018-02-02
  • Updated: 2019-01-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Refer to JDK-8137326, we're adding a couple of overloading methods in java/lang/StringLatin1 and StringUTF16. Please consider making them intrinsics as the original methods.

StringLatin1
@@ -101,10 +101,14 @@
 
     @HotSpotIntrinsicCandidate
     public static int compareTo(byte[] value, byte[] other) {
         int len1 = value.length;
         int len2 = other.length;
+        return compareTo(value, other, len1, len2);
+    }
+
+    public static int compareTo(byte[] value, byte[] other, int len1, int len2) {
         int lim = Math.min(len1, len2);
         for (int k = 0; k < lim; k++) {
             if (value[k] != other[k]) {
                 return getChar(value, k) - getChar(other, k);
             }

@@ -114,10 +118,14 @@
 
     @HotSpotIntrinsicCandidate
     public static int compareToUTF16(byte[] value, byte[] other) {
         int len1 = length(value);
         int len2 = StringUTF16.length(other);
+        return compareToUTF16(value, other, len1, len2);
+    }
+
+    public static int compareToUTF16(byte[] value, byte[] other, int len1, int len2) {
         int lim = Math.min(len1, len2);
         for (int k = 0; k < lim; k++) {
             char c1 = getChar(value, k);
             char c2 = StringUTF16.getChar(other, k);
             if (c1 != c2) {


StringUTF16
@@ -271,10 +271,14 @@
 
     @HotSpotIntrinsicCandidate
     public static int compareTo(byte[] value, byte[] other) {
         int len1 = length(value);
         int len2 = length(other);
+        return compareTo(value, other, len1, len2);
+    }
+
+    public static int compareTo(byte[] value, byte[] other, int len1, int len2) {
         int lim = Math.min(len1, len2);
         for (int k = 0; k < lim; k++) {
             char c1 = getChar(value, k);
             char c2 = getChar(other, k);
             if (c1 != c2) {

@@ -287,10 +291,14 @@
     @HotSpotIntrinsicCandidate
     public static int compareToLatin1(byte[] value, byte[] other) {
         return -StringLatin1.compareToUTF16(other, value);
     }
 
+    public static int compareToLatin1(byte[] value, byte[] other, int len1, int len2) {
+        return -StringLatin1.compareToUTF16(other, value, len2, len1);
+    }
+
     public static int compareToCI(byte[] value, byte[] other) {
         int len1 = length(value);
         int len2 = length(other);
         int lim = Math.min(len1, len2);
         for (int k = 0; k < lim; k++) {