RFR: 8299844: RISC-V: Implement _onSpinWait intrinsic
Feilong Jiang
fjiang at openjdk.org
Wed Jan 11 12:41:15 UTC 2023
On Tue, 10 Jan 2023 09:52:40 GMT, Yadong Wang <yadongwang at openjdk.org> wrote:
> Implement _onSpinWait() intrinsic for RISC-V, and it can be implemented by using PAUSE instruction from Zihintpause Extension, which is ratified and a mandatory extension of RVA22U64 (https://github.com/riscv/riscv-profiles/blob/main/profiles.adoc#rva22u64-mandatory-extensions).
> Software can use the PAUSE instruction to reduce energy consumption while executing spinwait
> code sequences (https://github.com/riscv/riscv-isa-manual/blob/master/src/zihintpause.tex).
>
> Add a test case of test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java, passed on QEMU.
Looks good, with some comments:
src/hotspot/cpu/riscv/assembler_riscv.hpp line 695:
> 693: }
> 694:
> 695: void pause() {
https://github.com/openjdk/jdk/pull/10697 moved all pseudo instructions to macroAssembler, I think `pause` should be defined in there too.
test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitRISCV64.java line 2:
> 1: /*
> 2: * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
Copyright here is Amazon.
-------------
Changes requested by fjiang (Author).
PR: https://git.openjdk.org/jdk/pull/11921
More information about the hotspot-dev
mailing list