Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8054307 JEP 254: Compact Strings
  3. JDK-8139316

Replace common copying loops with arraycopy/copyOf/copyOfRange

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None

      Description

      In current implementation, we have the manual copy loops:

          @HotSpotIntrinsicCandidate
          public static byte[] toBytes(char[] value, int off, int len) {
              byte[] val = new byte[len << 1];
              for (int i = 0; i < len; i++) {
                  putChar(val, i, value[off++]);
              }
              return val;
          }

      ....

                  byte buf[] = new byte[value.length];
                  for (int j = 0; j < i; j++) {
                      putChar(buf, j, getChar(value, j)); // TBD:arraycopy?
                  }

      These can be substituted with System.arraycopy, Arrays.copyOf[Range], etc.

        Attachments

          Activity

            People

            • Assignee:
              shade Aleksey Shipilev
              Reporter:
              shade Aleksey Shipilev
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: