Replace common copying loops with arraycopy/copyOf/copyOfRange

XMLWordPrintable

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

      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.

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

              Created:
              Updated:
              Resolved: