RFR: 8343249: [Windows] Implement SpinPause

David Holmes dholmes at openjdk.org
Thu Oct 31 05:46:27 UTC 2024


On Wed, 30 Oct 2024 06:29:29 GMT, Julian Waters <jwaters at openjdk.org> wrote:

> SpinPause is currently not implemented on any Windows platforms, due to a lack of access to assembly in the Microsoft compiler. The YieldProcessor macro can act as a stand in for this purpose, as it compiles down to a single pause instruction on x64 (Which seems to be all that one needs to implement SpinPause in HotSpot). I am less certain about the Windows/ARM64 implementation. There, YieldProcessor compiles down to dmb ishst; yield and I am unsure whether that is a correct SpinPause implementation. If need be, I can retract the ARM64 implementation and only have this for x86

I don't think this is worthwhile. The specification for `YieldProcessor` states it only works for hyperthreaded processors.  [1] This change doesn't obviously make anything better so I'd suggest leaving it alone in case it makes something worse. The DMB on Aarch64 seems a bit concerning and not obviously needed just to yield the processor.

[1] https://learn.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-yieldprocessor

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/21781#pullrequestreview-2406961988


More information about the hotspot-runtime-dev mailing list