RFR: 8334843: RISC-V: Fix wraparound checking for r_array_index in lookup_secondary_supers_table_slow_path

Gui Cao gcao at openjdk.org
Mon Jun 24 14:20:35 UTC 2024


Branch condition for r_array_index wraparound checking in lookup_secondary_supers_table_slow_path is wrong.

    // Check for wraparound.
    Label skip;
    bge(r_array_length, r_array_index, skip);
    mv(r_array_index, zr);
    bind(skip);

As discussed at https://github.com/openjdk/jdk/pull/19320/files#r1650548279 . If length == index, then we must set index to 0. That is `blt(r_array_index,r_array_length,skip);`.

### Correctness testing:
- [ ] Run tier1-3 tests on SOPHON SG2042 (release)

### JMH tested on SOPHON SG2042 (has not Zbb)
without this patch:

Benchmark                             Mode  Cnt    Score   Error  Units
SecondarySupersLookup.testNegative00  avgt   15   20.649 ± 0.147  ns/op
SecondarySupersLookup.testNegative01  avgt   15   20.649 ± 0.117  ns/op
SecondarySupersLookup.testNegative02  avgt   15   20.637 ± 0.116  ns/op
SecondarySupersLookup.testNegative03  avgt   15   20.638 ± 0.113  ns/op
SecondarySupersLookup.testNegative04  avgt   15   20.638 ± 0.127  ns/op
SecondarySupersLookup.testNegative05  avgt   15   20.639 ± 0.115  ns/op
SecondarySupersLookup.testNegative06  avgt   15   20.638 ± 0.119  ns/op
SecondarySupersLookup.testNegative07  avgt   15   20.850 ± 0.457  ns/op
SecondarySupersLookup.testNegative08  avgt   15   20.842 ± 0.459  ns/op
SecondarySupersLookup.testNegative09  avgt   15   20.650 ± 0.124  ns/op
SecondarySupersLookup.testNegative10  avgt   15   20.642 ± 0.127  ns/op
SecondarySupersLookup.testNegative16  avgt   15   20.657 ± 0.157  ns/op
SecondarySupersLookup.testNegative20  avgt   15   20.669 ± 0.152  ns/op
SecondarySupersLookup.testNegative30  avgt   15   20.668 ± 0.166  ns/op
SecondarySupersLookup.testNegative32  avgt   15   20.669 ± 0.168  ns/op
SecondarySupersLookup.testNegative40  avgt   15   20.668 ± 0.174  ns/op
SecondarySupersLookup.testNegative50  avgt   15   20.682 ± 0.194  ns/op
SecondarySupersLookup.testNegative55  avgt   15  113.369 ± 3.792  ns/op
SecondarySupersLookup.testNegative56  avgt   15  113.888 ± 3.769  ns/op
SecondarySupersLookup.testNegative57  avgt   15  115.320 ± 4.271  ns/op
SecondarySupersLookup.testNegative58  avgt   15  115.648 ± 2.985  ns/op
SecondarySupersLookup.testNegative59  avgt   15  117.730 ± 3.370  ns/op
SecondarySupersLookup.testNegative60  avgt   15  142.533 ± 3.636  ns/op
SecondarySupersLookup.testNegative61  avgt   15  144.901 ± 5.267  ns/op
SecondarySupersLookup.testNegative62  avgt   15  145.926 ± 3.799  ns/op
SecondarySupersLookup.testNegative63  avgt   15  207.704 ± 5.370  ns/op
SecondarySupersLookup.testNegative64  avgt   15  210.631 ± 3.832  ns/op
SecondarySupersLookup.testPositive01  avgt   15   20.334 ± 0.455  ns/op
SecondarySupersLookup.testPositive02  avgt   15   20.126 ± 0.101  ns/op
SecondarySupersLookup.testPositive03  avgt   15   20.126 ± 0.097  ns/op
SecondarySupersLookup.testPositive04  avgt   15   20.124 ± 0.102  ns/op
SecondarySupersLookup.testPositive05  avgt   15   20.119 ± 0.100  ns/op
SecondarySupersLookup.testPositive06  avgt   15   20.126 ± 0.098  ns/op
SecondarySupersLookup.testPositive07  avgt   15   20.321 ± 0.462  ns/op
SecondarySupersLookup.testPositive08  avgt   15   20.117 ± 0.098  ns/op
SecondarySupersLookup.testPositive09  avgt   15   20.534 ± 0.555  ns/op
SecondarySupersLookup.testPositive10  avgt   15   20.120 ± 0.100  ns/op
SecondarySupersLookup.testPositive16  avgt   15   20.125 ± 0.104  ns/op
SecondarySupersLookup.testPositive20  avgt   15   20.125 ± 0.116  ns/op
SecondarySupersLookup.testPositive30  avgt   15   20.132 ± 0.110  ns/op
SecondarySupersLookup.testPositive32  avgt   15   20.328 ± 0.449  ns/op
SecondarySupersLookup.testPositive40  avgt   15   20.132 ± 0.096  ns/op
SecondarySupersLookup.testPositive50  avgt   15   20.331 ± 0.460  ns/op
SecondarySupersLookup.testPositive60  avgt   15   20.134 ± 0.104  ns/op
SecondarySupersLookup.testPositive63  avgt   15   20.128 ± 0.104  ns/op
SecondarySupersLookup.testPositive64  avgt   15   20.334 ± 0.456  ns/op
Finished running test 'micro:vm.lang.SecondarySupersLookup'


with this patch:

Benchmark                             Mode  Cnt    Score   Error  Units
SecondarySupersLookup.testNegative00  avgt   15   20.644 ± 0.118  ns/op
SecondarySupersLookup.testNegative01  avgt   15   20.639 ± 0.124  ns/op
SecondarySupersLookup.testNegative02  avgt   15   20.645 ± 0.111  ns/op
SecondarySupersLookup.testNegative03  avgt   15   20.647 ± 0.114  ns/op
SecondarySupersLookup.testNegative04  avgt   15   20.641 ± 0.112  ns/op
SecondarySupersLookup.testNegative05  avgt   15   22.702 ± 0.166  ns/op
SecondarySupersLookup.testNegative06  avgt   15   20.654 ± 0.116  ns/op
SecondarySupersLookup.testNegative07  avgt   15   20.663 ± 0.147  ns/op
SecondarySupersLookup.testNegative08  avgt   15   20.650 ± 0.114  ns/op
SecondarySupersLookup.testNegative09  avgt   15   20.666 ± 0.130  ns/op
SecondarySupersLookup.testNegative10  avgt   15   20.665 ± 0.155  ns/op
SecondarySupersLookup.testNegative16  avgt   15   20.670 ± 0.154  ns/op
SecondarySupersLookup.testNegative20  avgt   15   20.674 ± 0.163  ns/op
SecondarySupersLookup.testNegative30  avgt   15   20.683 ± 0.168  ns/op
SecondarySupersLookup.testNegative32  avgt   15   20.681 ± 0.172  ns/op
SecondarySupersLookup.testNegative40  avgt   15   20.683 ± 0.167  ns/op
SecondarySupersLookup.testNegative50  avgt   15   20.691 ± 0.188  ns/op
SecondarySupersLookup.testNegative55  avgt   15  112.106 ± 3.051  ns/op
SecondarySupersLookup.testNegative56  avgt   15  112.728 ± 3.976  ns/op
SecondarySupersLookup.testNegative57  avgt   15  114.488 ± 3.391  ns/op
SecondarySupersLookup.testNegative58  avgt   15  116.445 ± 4.055  ns/op
SecondarySupersLookup.testNegative59  avgt   15  116.419 ± 3.347  ns/op
SecondarySupersLookup.testNegative60  avgt   15  144.107 ± 4.251  ns/op
SecondarySupersLookup.testNegative61  avgt   15  145.079 ± 4.456  ns/op
SecondarySupersLookup.testNegative62  avgt   15  146.440 ± 4.284  ns/op
SecondarySupersLookup.testNegative63  avgt   15  209.836 ± 8.016  ns/op
SecondarySupersLookup.testNegative64  avgt   15  209.803 ± 7.432  ns/op
SecondarySupersLookup.testPositive01  avgt   15   20.146 ± 0.111  ns/op
SecondarySupersLookup.testPositive02  avgt   15   20.136 ± 0.101  ns/op
SecondarySupersLookup.testPositive03  avgt   15   20.133 ± 0.098  ns/op
SecondarySupersLookup.testPositive04  avgt   15   20.148 ± 0.105  ns/op
SecondarySupersLookup.testPositive05  avgt   15   20.634 ± 0.097  ns/op
SecondarySupersLookup.testPositive06  avgt   15   20.135 ± 0.106  ns/op
SecondarySupersLookup.testPositive07  avgt   15   20.139 ± 0.103  ns/op
SecondarySupersLookup.testPositive08  avgt   15   20.133 ± 0.098  ns/op
SecondarySupersLookup.testPositive09  avgt   15   20.340 ± 0.456  ns/op
SecondarySupersLookup.testPositive10  avgt   15   20.135 ± 0.104  ns/op
SecondarySupersLookup.testPositive16  avgt   15   20.127 ± 0.094  ns/op
SecondarySupersLookup.testPositive20  avgt   15   20.131 ± 0.103  ns/op
SecondarySupersLookup.testPositive30  avgt   15   20.142 ± 0.102  ns/op
SecondarySupersLookup.testPositive32  avgt   15   20.135 ± 0.095  ns/op
SecondarySupersLookup.testPositive40  avgt   15   20.128 ± 0.094  ns/op
SecondarySupersLookup.testPositive50  avgt   15   20.135 ± 0.097  ns/op
SecondarySupersLookup.testPositive60  avgt   15   20.130 ± 0.094  ns/op
SecondarySupersLookup.testPositive63  avgt   15   20.139 ± 0.101  ns/op
SecondarySupersLookup.testPositive64  avgt   15   20.130 ± 0.100  ns/op
Finished running test 'micro:vm.lang.SecondarySupersLookup'

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

Commit messages:
 - 8334843: RISC-V: Fix wraparound checking for r_array_index in lookup_secondary_supers_table_slow_path

Changes: https://git.openjdk.org/jdk/pull/19852/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=19852&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8334843
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/19852.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19852/head:pull/19852

PR: https://git.openjdk.org/jdk/pull/19852


More information about the hotspot-dev mailing list