RFR: 8186670: Implement _onSpinWait() intrinsic for AArch64 [v3]

Evgeny Astigeevich github.com+42899633+eastig at openjdk.java.net
Wed Sep 22 12:32:02 UTC 2021


On Wed, 22 Sep 2021 07:49:36 GMT, Andrew Haley <aph at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp line 1385:
>> 
>>> 1383:   // Code for java.lang.Thread::onSpinWait() intrinsic.
>>> 1384:   void spin_wait() {
>>> 1385: #define EMIT_N_INST(n, inst) for (int i = 0; i < (n); ++i) inst()
>> 
>> Why use a macro here? You could just put the loop around the switch statement. And the method body seems sufficiently large that it ought to go in the .cpp file.
>
> Good point. There's no significant performance advantage to having this in the header.

> Why use a macro here? You could just put the loop around the switch statement. And the method body seems sufficiently large that it ought to go in the .cpp file.

:) compiler engineering experience. Compilers have a problem to apply unswitching optimization to loop-invariant SWITCHes.
I'll update the code as suggested.

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

PR: https://git.openjdk.java.net/jdk/pull/5562


More information about the hotspot-dev mailing list