RFR: 8321371: SpinPause() not implemented for bsd_aarch64/macOS
Fredrik Bredberg
fbredberg at openjdk.org
Thu Dec 21 09:48:50 UTC 2023
On Wed, 20 Dec 2023 21:14:47 GMT, Evgeny Astigeevich <eastigeevich at openjdk.org> wrote:
>> @eastig @fisk
>>
>> I've now rewritten `SpinPause()` so you can use the `OnSpinWaitInst` option to choose between `none`, `nop`, `isb` and `yield`.
>> I choose not to change the default from `none` to `yield` in this PR. For that I've created [JDK-8322535](https://bugs.openjdk.org/browse/JDK-8322535).
>
> @fbredber
> The assembly code looks good to me.
> Out of curiosity, why not to use a regular `switch`? Why is the manually written assembly better?
> What if it looked like the following:
>
> class SpinWait {
> public:
> static void exec(Inst inst) {
> switch (inst) {
> case NOP:
> asm volatile();
> break;
> case ISB:
> asm volatile();
> break;
> case YIELD:
> asm volatile();
> break;
> default:
> }
> }
> ...
> };
>
> extern "C" {
> int SpinPause() {
> SpinWait::exec(VM_Version::spin_wait_desc().inst());
> return 1;
> }
@eastig
> Out of curiosity, why not to use a regular `switch`? Why is the manually written assembly better?
I just like to keep away from conditional branches in code that is supposed to be in tight loops. :)
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16994#issuecomment-1865955740
More information about the hotspot-runtime-dev
mailing list