RFR: 8186670: Implement _onSpinWait() intrinsic for AArch64 [v8]

Stuart Monteith smonteith at openjdk.java.net
Tue Sep 28 11:31:09 UTC 2021


On Thu, 23 Sep 2021 14:14:38 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:
> 
>   Separate OnSpinWaitImpl into OnSpinWaitInst and OnSpinWaitInstCount

Overall looks fine, but the tests look like they need to work with hsdis.

test/hotspot/jtreg/compiler/onSpinWait/TestOnSpinWaitAArch64.java line 87:

> 85:     private static String getSpinWaitInstHex(String spinWaitInst) {
> 86:       if ("nop".equals(spinWaitInst)) {
> 87:           return "1f20 03d5";

I'm getting the following when running these tests:
STDERR:
java.lang.RuntimeException: Wrong instruction 1f20 03d5 count 0!
  -- expecting 7
        at compiler.onSpinWait.TestOnSpinWaitAArch64.checkOutput(TestOnSpinWaitAArch64.java:163)
        at compiler.onSpinWait.TestOnSpinWaitAArch64.main(TestOnSpinWaitAArch64.java:82)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
        at java.base/java.lang.Thread.run(Thread.java:833)

I have hsdis installed as a matter of course, is the test written assuming hsdis is not present?

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

Changes requested by smonteith (Author).

PR: https://git.openjdk.java.net/jdk/pull/5562


More information about the hotspot-dev mailing list