RFR: 8186670: Implement _onSpinWait() intrinsic for AArch64 [v3]
Evgeny Astigeevich
github.com+42899633+eastig at openjdk.java.net
Wed Sep 22 12:36:58 UTC 2021
On Tue, 21 Sep 2021 22:22:50 GMT, Evgeny Astigeevich <github.com+42899633+eastig at openjdk.org> wrote:
>> This PR is a follow-up on the discussion [“RFC: AArch64: Implementing spin pauses with ISB”](https://mail.openjdk.java.net/pipermail/hotspot-dev/2021-August/054033.html).
>>
>> It adds the option `OnSpinWaitImpl=value`, where `value` can be:
>>
>> - `none`: no implementation for spin pauses. This is the default value.
>> - `Nnop`: use `nop` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `nop` instructions.
>> - `Nisb`: use `isb` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `isb` instructions.
>> - `Nyield`: use `yield` instruction for spin pauses. Optional `N` can be `2..9` to specify a number of `yield` instructions.
>>
>> The code for the `Thread.onSpinWait` intrinsic is generated based on the value of `OnSpinWaitImpl`.
>>
>> Testing:
>>
>> - `make test TEST="gtest"`: Passed
>> - `make run-test TEST="tier1"`: Passed
>> - `make run-test TEST="tier2"`: Passed
>> - `make run-test TEST=hotspot/jtreg/compiler/onSpinWait`: Passed
>
> Evgeny Astigeevich has updated the pull request incrementally with one additional commit since the last revision:
>
> Move emitting code to MacroAssembler::spin_wait
>
> Code emitting spin pauses is moved to MacroAssembler::spin_wait.
> As OptoAssembly output is changed, tests are updated to parse
> PrintAssembly.
@theRealAph, when I was writing a test I notice a strange thing in `PrintAssembly` output:
# {method} {0x0000ffff6ac00370} 'test' '()V' in 'compiler/onSpinWait/TestOnSpinWaitImplAArch64$Launcher'
# [sp+0x40] (sp of caller)
0x0000ffff9d557680: 1f20 03d5 | e953 40d1 | 3f01 00f9 | ff03 01d1 | fd7b 03a9 | 1f20 03d5 | 1f20 03d5 | 1f20 03d5
0x0000ffff9d5576a0: 1f20 03d5 | 1f20 03d5 | 1f20 03d5
0x0000ffff9d5576ac: ;*invokestatic onSpinWait {reexecute=0 rethrow=0 return_oop=0}
; - compiler.onSpinWait.TestOnSpinWaitImplAArch64$Launcher::test at 0 (line 161)
0x0000ffff9d5576ac: 1f20 03d5 | fd7b 43a9 | ff03 0191
The code is for the case when 7 NOPs are used for a spin pause.
In the output only one instruction is after `invokestatic onSpinWait`. Other 6 instructions are before it.
Is it expected behaviour or a bug?
-------------
PR: https://git.openjdk.java.net/jdk/pull/5562
More information about the hotspot-dev
mailing list