RFR: 8321371: SpinPause() not implemented for bsd_aarch64/macOS [v2]

Daniel D. Daugherty dcubed at openjdk.org
Thu Dec 21 16:27:53 UTC 2023


On Wed, 20 Dec 2023 12:11:18 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.
>
> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   SpinPause() is now configurable on bsd_aarch64/macOS

Thumbs up with a couple of minor nits.

I like the idea of hooking the os_bsd_aarch64 version of `SpinPause`
into the OnSpinWaitInst option. This will enable easier experimentation
in the future without specially built binaries to switch the `SpinPause`
implementation.

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp line 531:

> 529:     assert( 0 == SpinWait::NOP,   "should be");
> 530:     assert( 1 == SpinWait::ISB,   "should be");
> 531:     assert( 2 == SpinWait::YIELD, "should be");

nit: these should all be "must be" in keeping with the existing HotSpot style
for that type of assert(). In specification language, "should" is optional and
"must" is a requirement.

src/hotspot/os_cpu/bsd_aarch64/os_bsd_aarch64.cpp line 534:

> 532: 
> 533:     asm volatile(
> 534:         "  adr  %[d], 20          \n" // 20 == PC here + 5 instructions => adress

nit typo: s/adress/address/

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

Marked as reviewed by dcubed (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/16994#pullrequestreview-1793282389
PR Review Comment: https://git.openjdk.org/jdk/pull/16994#discussion_r1434265973
PR Review Comment: https://git.openjdk.org/jdk/pull/16994#discussion_r1434267027


More information about the hotspot-runtime-dev mailing list