[jdk17u-dev] RFR: 8310268: RISC-V: misaligned memory access in String.Compare intrinsic

Olga Mikhaltsova omikhaltcova at openjdk.org
Fri Oct 13 21:44:21 UTC 2023


I'd like to backport JDK-8310268 to jdk17u. This fix is related only to RISC-V.

The patch applies cleanly.

Testing: tier1 tests successfully passed on a RISC-V HiFive board with Linux.

As it's described in the original fix, this performance improvement can be observed by running the StringCompareToDifferentLength benchmark. The results for jdk17u are as follow:

Before

Benchmark                                   (delta)  (size)  Mode  Cnt   Score   Error  Units
StringCompareToDifferentLength.compareToLL        2       7  avgt    9   4.703 ± 0.090  ms/op
StringCompareToDifferentLength.compareToLL        2       8  avgt    9   4.896 ± 0.059  ms/op
StringCompareToDifferentLength.compareToLL        2      15  avgt    9  97.280 ± 2.008  ms/op
StringCompareToDifferentLength.compareToLL        2      24  avgt    9   3.685 ± 0.031  ms/op
StringCompareToDifferentLength.compareToLL        2      36  avgt    9  97.924 ± 1.230  ms/op
StringCompareToDifferentLength.compareToLU        2       7  avgt    9  85.896 ± 3.747  ms/op
StringCompareToDifferentLength.compareToLU        2       8  avgt    9   5.095 ± 0.065  ms/op
StringCompareToDifferentLength.compareToLU        2      15  avgt    9  87.073 ± 0.639  ms/op
StringCompareToDifferentLength.compareToLU        2      24  avgt    9   9.631 ± 0.021  ms/op
StringCompareToDifferentLength.compareToLU        2      36  avgt    9  13.416 ± 0.088  ms/op
StringCompareToDifferentLength.compareToUL        2       7  avgt    9  86.940 ± 0.923  ms/op
StringCompareToDifferentLength.compareToUL        2       8  avgt    9   7.155 ± 0.068  ms/op
StringCompareToDifferentLength.compareToUL        2      15  avgt    9  89.326 ± 0.864  ms/op
StringCompareToDifferentLength.compareToUL        2      24  avgt    9  11.678 ± 0.104  ms/op
StringCompareToDifferentLength.compareToUL        2      36  avgt    9  15.966 ± 0.344  ms/op
StringCompareToDifferentLength.compareToUU        2       7  avgt    9  97.076 ± 0.818  ms/op
StringCompareToDifferentLength.compareToUU        2       8  avgt    9   3.625 ± 0.035  ms/op
StringCompareToDifferentLength.compareToUU        2      15  avgt    9  97.576 ± 1.118  ms/op
StringCompareToDifferentLength.compareToUU        2      24  avgt    9   4.825 ± 0.070  ms/op
StringCompareToDifferentLength.compareToUU        2      36  avgt    9   6.221 ± 0.035  ms/op

After

Benchmark                                   (delta)  (size)  Mode  Cnt   Score   Error  Units
StringCompareToDifferentLength.compareToLL        2       7  avgt    9   4.642 ± 0.074  ms/op
StringCompareToDifferentLength.compareToLL        2       8  avgt    9   4.885 ± 0.011  ms/op
StringCompareToDifferentLength.compareToLL        2      15  avgt    9   5.225 ± 0.057  ms/op
StringCompareToDifferentLength.compareToLL        2      24  avgt    9   5.514 ± 0.073  ms/op
StringCompareToDifferentLength.compareToLL        2      36  avgt    9   6.376 ± 0.081  ms/op
StringCompareToDifferentLength.compareToLU        2       7  avgt    9   5.759 ± 0.039  ms/op
StringCompareToDifferentLength.compareToLU        2       8  avgt    9   5.781 ± 0.069  ms/op
StringCompareToDifferentLength.compareToLU        2      15  avgt    9   7.914 ± 0.132  ms/op
StringCompareToDifferentLength.compareToLU        2      24  avgt    9  10.063 ± 0.103  ms/op
StringCompareToDifferentLength.compareToLU        2      36  avgt    9  13.274 ± 0.101  ms/op
StringCompareToDifferentLength.compareToUL        2       7  avgt    9   7.360 ± 0.057  ms/op
StringCompareToDifferentLength.compareToUL        2       8  avgt    9   7.369 ± 0.042  ms/op
StringCompareToDifferentLength.compareToUL        2      15  avgt    9   9.374 ± 0.063  ms/op
StringCompareToDifferentLength.compareToUL        2      24  avgt    9  11.415 ± 0.197  ms/op
StringCompareToDifferentLength.compareToUL        2      36  avgt    9  14.468 ± 0.317  ms/op
StringCompareToDifferentLength.compareToUU        2       7  avgt    9   4.359 ± 0.049  ms/op
StringCompareToDifferentLength.compareToUU        2       8  avgt    9   4.365 ± 0.078  ms/op
StringCompareToDifferentLength.compareToUU        2      15  avgt    9   4.897 ± 0.073  ms/op
StringCompareToDifferentLength.compareToUU        2      24  avgt    9   5.450 ± 0.097  ms/op
StringCompareToDifferentLength.compareToUU        2      36  avgt    9   6.521 ± 0.091  ms/op

-------------

Commit messages:
 - Backport d6245b6832ccd1da04616e8ba4b90321b2551971

Changes: https://git.openjdk.org/jdk17u-dev/pull/1876/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk17u-dev&pr=1876&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8310268
  Stats: 145 lines in 4 files changed: 25 ins; 44 del; 76 mod
  Patch: https://git.openjdk.org/jdk17u-dev/pull/1876.diff
  Fetch: git fetch https://git.openjdk.org/jdk17u-dev.git pull/1876/head:pull/1876

PR: https://git.openjdk.org/jdk17u-dev/pull/1876


More information about the jdk-updates-dev mailing list