RFR: 8292713: Unsafe.allocateInstance should be intrinsified without UseUnalignedAccesses
Fei Yang
fyang at openjdk.org
Wed Aug 24 12:32:38 UTC 2022
On Mon, 22 Aug 2022 21:04:05 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
> See the rationale and references in the bug. I spotted that RISC-V tests are remarkably slow, and profiler shows that `Unsafe.allocateInstance` is very hot and native. RISC-V and ARM32 systems are `UseUnalignedAccess = false`, and I believe the `_allocateInstance` intrinsic is disabled on these paths by mistake. This PR improves the selected tests very considerably, and I think it actually fixes the real performance bug in `java.lang.invoke`-rich code paths.
>
> Raspberry Pi 4, ARM32 fastdebug build:
>
>
> $ time make test TEST=java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java
>
> # Baseline
>
> real 4m37.970s
> user 6m5.490s
> sys 0m21.731s
>
> real 4m52.363s
> user 6m24.100s
> sys 0m21.363s
>
> # Patched
>
> real 2m32.678s ; <--- 1.8x faster
> user 4m33.749s
> sys 0m22.127s
>
> real 2m38.451s ; <--- 1.8x faster, reproducible
> user 4m44.788s
> sys 0m22.160s
>
>
> HiFive Unmatched, RISC-V fastdebug build:
>
>
> $ time make test TEST=java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java
>
> # Baseline
>
> real 19m3.479s
> user 27m2.932s
> sys 0m27.766s
>
> real 18m52.351s
> user 27m23.917s
> sys 0m27.682s
>
> # Patched
>
> real 10m5.971s ; <--- 1.9x faster
> user 18m11.538s
> sys 0m28.204s
>
> real 10m18.973s ; <--- 1.9x faster, reproducible
> user 18m31.067s
> sys 0m28.053s
>
>
> Additional testing:
> - [x] Linux RISC-V build, timing tests
> - [x] Linux ARM32 build, timing tests
> - [x] Linux ARM32 fastdebug `tier1`
Passed tier1 hotspot & jdk test on riscv64-linux unmatched board. Looks good to me.
-------------
Marked as reviewed by fyang (Reviewer).
PR: https://git.openjdk.org/jdk/pull/9970
More information about the hotspot-compiler-dev
mailing list