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

Implement C1 clone intrinsic that reuses arraycopy code for primitive arrays

    XMLWordPrintable

Details

    • b23

    Description

      C1 has an intrinsic for System.arraycopy. It might be beneficial and straightforward to wire up Object.clone to use the same ArrayCopyNode when applicable (primitive arrays, in particular):

      osx-aarch64, -XX:TieredStopAtLevel=1
      Benchmark (size) Mode Cnt Score Error Units
      ArrayClone.byteArraycopy 15 avgt 15 3,729 ± 0,045 ns/op
      ArrayClone.byteClone 15 avgt 15 76,019 ± 1,431 ns/op
      ArrayClone.intArraycopy 15 avgt 15 5,269 ± 0,018 ns/op
      ArrayClone.intClone 15 avgt 15 77,157 ± 1,203 ns/op

      linux-x64, -XX:TieredStopAtLevel=1:
      Benchmark (size) Mode Cnt Score Error Units
      ArrayClone.byteArraycopy 15 avgt 15 9.888 ± 0.380 ns/op
      ArrayClone.byteClone 15 avgt 15 81.546 ± 1.772 ns/op
      ArrayClone.intArraycopy 15 avgt 15 15.783 ± 0.625 ns/op
      ArrayClone.intClone 15 avgt 15 82.882 ± 2.447 ns/op

      This was missed when initially adding a microbenchmark to compare System.arraycopy and array.clone during JDK-8302315

      Attachments

        Issue Links

          Activity

            People

              galder Galder ZamarreƱo
              redestad Claes Redestad
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: