RFR: 8321371: SpinPause() not implemented for bsd_aarch64/macOS
Evgeny Astigeevich
eastigeevich at openjdk.org
Wed Dec 13 11:57:41 UTC 2023
On Wed, 13 Dec 2023 09:51:39 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> The SpinPause() function only returns 0 on bsd_aarch64 (i.e. macOS)
>>
>> This PR initially meant to implement SpinPause() for macOS on AArch64 by copying the source from linux_aarch64, but after having some internal discussions, it seems like the most reasonable thing to do is to implement SpinPause() using a single inline yield instruction.
>>
>> Tested successfully on macosx-aarch64 tier1-tier5.
>
> Paging @eastig and @theRealAph here.
@shipilev wrote on JDK-8321371:
> I remember trying the same thing along with [JDK-8318986](https://bugs.openjdk.org/browse/JDK-8318986), but I realized SpinPause() is only used from the quite hot VM native code, and so it would probably affect GC and runtime performance. The actual Thread.onSpinWait from Java code should be already handled by intrinsics. I suspect the overhead of doing the stub call is already similar to whatever hint we finally emit in the stub, but the WX transition back and forth is likely to be quite bad to make often. SpinWait is quite likely used in busy loops, so this would add up.
I don't know what WX transition is.
I can comment:
> The actual Thread.onSpinWait from Java code should be already handled by intrinsics.
As bsd_aarch64 does not define what to use for spin wait, the intrinsic has no code.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16994#issuecomment-1853779861
More information about the hotspot-runtime-dev
mailing list