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

Daniel D. Daugherty dcubed at openjdk.org
Thu Dec 21 16:15:50 UTC 2023


On Thu, 21 Dec 2023 09:45:35 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

>> @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. :)

@fbredber - This PR's description and the final comment in [JDK-8321371](https://bugs.openjdk.org/browse/JDK-8321371)
are out of date relative to the change in direction. Please update the PR's description
and add a new comment to the bug to reflect the current design of the change.

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

PR Comment: https://git.openjdk.org/jdk/pull/16994#issuecomment-1866583110


More information about the hotspot-runtime-dev mailing list