Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8196710

Intrinsify new StringLatin1/StringUTF16 methods

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 11
    • hotspot

      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++) {

            Unassigned Unassigned
            joehw Joe Wang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: