3 ms·
Indeed the load/load fence must be before the "final long currentVersion" load—which in turn can be a relaxed load—not after the first load. On x86 this produc
by bonzini 3y ago
Indeed the load/load fence must be before the "final long currentVersion" load—which in turn can be a relaxed load—not after the first load.
On x86 this produces optimal code because the load/load fence does not need to be compiled into a processor instruction (LFENCE and SFENCE exist but are only used in very special cases; they aren't needed for normal memory and normal load instructions).