Using x86 pause instr in SpinPause

Eric Caspole eric.caspole at amd.com
Thu Aug 16 11:01:06 PDT 2012


Hi everybody,
Does anybody know the reason why SpinPause is simply "return 0" on  
Win64 but uses PAUSE on Linux in a .s file?
We would like to remove PAUSE from linux too.

Thanks,
Eric


./src/os_cpu/windows_x86/vm/os_windows_x86.cpp

     548 extern "C" int SpinPause () {
     549 #ifdef AMD64
     550    return 0 ;
     551 #else
     552    // pause == rep:nop
     553    // On systems that don't support pause a rep:nop
     554    // is executed as a nop.  The rep: prefix is ignored.
     555    _asm {
     556       pause ;
     557    };
     558    return 1 ;
     559 #endif // AMD64
     560 }


src/os_cpu/linux_x86/vm/linux_x86_64.s

      63         .globl SpinPause
      64         .align 16
      65         .type  SpinPause, at function
      66 SpinPause:
      67         rep
      68         nop
      69         movq   $1, %rax
      70         ret




More information about the hotspot-runtime-dev mailing list