RFR: 8318159: RISC-V: Improve itable_stub
Fei Yang
fyang at openjdk.org
Thu Nov 16 04:44:30 UTC 2023
On Tue, 14 Nov 2023 15:01:51 GMT, Yuri Gaevsky <duke at openjdk.org> wrote:
> Please review the change for RISC-V similar to #13792(AARCH64) and #13460(X86).
>
> From #13792:
> The change replaces two separate iterations over the itable with new algorithm
> consisting of two loops. First, we look for a match with resolved_klass,
> checking for a match with holder_klass along the way. Then we continue iterating
> (not starting over) the itable using the second loop, checking only for a match
> with holder_klass.
>
> ### Correctness checks
>
> Testing: tier1 tests successfully passed on HiFive Unmatched board.
>
> #### Performance results on RISC-V StarFive JH7110 board:
>
>
> InterfaceCalls: before fix after fix
> -------------------------------------------------------------------
> Benchmark Mode Cnt Score Error Score Error Units
> -------------------------------------------------------------------
> test1stInt2Types avgt 100 14.380 ? 0.017 | 14.370 ? 0.014 ns/op
> test1stInt3Types avgt 100 72.724 ? 0.552 | 66.290 ? 0.080 ns/op
> test1stInt5Types avgt 100 73.948 ? 0.524 | 68.781 ? 0.377 ns/op
> test2ndInt2Types avgt 100 15.705 ? 0.016 | 15.707 ? 0.018 ns/op
> test2ndInt3Types avgt 100 82.370 ? 0.453 | 75.363 ? 0.156 ns/op
> test2ndInt5Types avgt 100 85.266 ? 0.466 | 80.969 ? 0.752 ns/op
> testIfaceCall avgt 100 75.684 ? 0.648 | 72.603 ? 0.460 ns/op
> testIfaceExtCall avgt 100 86.293 ? 0.567 | 77.939 ? 0.340 ns/op
> testMonomorphic avgt 100 11.357 ? 0.007 | 11.359 ? 0.009 ns/op
> -------------------------------------------------------------------
>
>
> #### Performance results on RISC-V HiFive Unmatched board:
>
>
> InterfaceCalls: before fix after fix
> ---------------------------------------------------------------------
> Benchmark Mode Cnt Score Error Score Error Units
> ---------------------------------------------------------------------
> test1stInt2Types avgt 100 24.432 ? 1.811 | 23.205 ? 1.512 ns/op
> test1stInt3Types avgt 100 135.800 ? 3.991 | 127.112 ? 2.299 ns/op
> test1stInt5Types avgt 100 141.746 ? 4.272 | 136.069 ? 4.919 ns/op
> test2ndInt2Types avgt 100 31.474 ? 2.468 | 26.978 ? 1.951 ns/op
> test2ndInt3Types avgt 100 146.410 ? 3.575 | 139.443 ? 3.677 ns/op
> test2ndInt5Types avgt 100 156.083 ? 3.617 | 150.583 ? 2.909 ns/op
> testIfaceCall avgt 100 136.392 ? 2.546 | 129.632 ? 1.662 ns/op
> testIfaceExtCall avgt 100 155.602 ? 3.836 | 138.058 ? 2.147 ns/op
> testMonomorphic avgt 100 24.018 ? 1.888 | 21.522 ? 1.662 ns/op
> ---------...
Changes requested by fyang (Reviewer).
src/hotspot/cpu/riscv/macroAssembler_riscv.cpp line 2562:
> 2560: mv(holder_offset, zr);
> 2561: // scan_temp = &(itable[0]._interface)
> 2562: la(scan_temp, Address(scan_temp));
The `la` call here won't emit any code on riscv [1]. So I think we can simply remove it and apply the code comment at L2561 to the preceding `shadd` call.
[1] https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp#L745
-------------
PR Review: https://git.openjdk.org/jdk/pull/16657#pullrequestreview-1733407682
PR Review Comment: https://git.openjdk.org/jdk/pull/16657#discussion_r1395092707
More information about the hotspot-dev
mailing list