RFR: 8362193: Re-work MacOS/AArch64 SpinPause to handle SB [v3]

Fredrik Bredberg fbredberg at openjdk.org
Wed Jul 23 11:52:55 UTC 2025


On Tue, 22 Jul 2025 22:41:32 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:

>> For the default YIELD we have:
>> - Original: ~250 clocks
>> - Compiler binary search tree: ~200 clocks (-20%)
>> - Optimized with `TBZ`: ~150 clocks (-40%)
>
> I think the differences might be smaller on the real hardware. Maybe everything will be around 200 clocks.
> If we need code easy to maintain then this is `switch`. If we need performance then this is `tbz`.

@eastig
I would prefer your `tbz` version for reasons stated earlier, but most notably to make it stable across toolchains.
But maybe it's best to just integrate it as is since there are other problems ([JDK-8361032](https://bugs.openjdk.org/browse/JDK-8361032) and [JDK-8360936](https://bugs.openjdk.org/browse/JDK-8360936)) that are waiting for this to be fixed.

Time will tell if this implementation will make performance better or worse. The debate of how to best implement `SpinPause()` will surely not end today. :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26387#discussion_r2225312820


More information about the hotspot-dev mailing list