RFR: 8321371: SpinPause() not implemented for bsd_aarch64/macOS
Fredrik Bredberg
fbredberg at openjdk.org
Thu Dec 14 11:23:40 UTC 2023
On Wed, 6 Dec 2023 14:01:49 GMT, Fredrik Bredberg <fbredberg 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.
I understand. Here the discussion went something like this:
The BSD port is almost strictly a MacOSX port. The configurability is more costly on MacOSX, because of the need to call os::current_thread_enable_wx().
The vast majority of MacOSX users don't want to configure which SpinPause instruction to use, they want something that is good straight out of the box.
Since there is a dedicated instruction (yield) in the AArch64 for this use case, we ought to use it. Because it's in the interest of the CPU vendor to have as good yield implementation as possible for each and every variety of the CPU. So if the user upgrades to a new CPU version, the SpinPause should still perform as good as possible, without the need to reconfigure.
For more info about the WX stuf, see here:
https://developer.apple.com/documentation/apple-silicon/porting-just-in-time-compilers-to-apple-silicon
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16994#issuecomment-1855664034
More information about the hotspot-runtime-dev
mailing list