615afdc2
by Jinoh Kang at 2025-04-28T16:31:57+02:00
Revert "kernel32/tests: Don't use _ReadWriteBarrier on ARM platforms."
This reverts commit 504a305a60849704f2d83b55e9aabb26d89edf11.
The choice of weak barrier was by design. The stronger barrier broke the
positive half of the litmus test for FlushProcessWriteBuffers():
> virtual.c:4568: Test failed: expected write-read reordering with compiler barrier
> only (got 0 reorderings)
FlushProcessWriteBuffers() is used in tandem with a compiler-only
barrier to implement fast synchronization, where only one side is
executed frequently and the other side only occassionally (e.g., garbage
collection). Prominent applications include .NET and HotSpot JVM.
Although _ReadWriteBarrier() is "marked deprecated," it is in fact used
by Microsoft's own STL library (with explicit suppression of warning) to
implement a compiler-only memory barrier [1]. The deprecation notice
suggests C++11 atomics as the (only?) alternative.
[1]: https://github.com/microsoft/STL/blob/b5df16a98934319e2e6864d6036cbe9cd9c74faf/stl/inc/xatomic.h#L56