swift-atomics icon indicating copy to clipboard operation
swift-atomics copied to clipboard

Implement sequentially consistent memory ordering for strong references

Open lorentey opened this issue 5 years ago • 0 comments

To simplify the initial implementation, atomic references currently treat all orderings as acquire/release, including .sequentiallyConsistent. This isn't tenable -- they should at least differentiate between acquire/release and sequentially consistent orderings. Supporting relaxed ordering is less crucial, given that strong references already involve some amount of memory fences.

Note that we don't want to inline the strong reference implementation into user code, so internally each supported ordering must be mapped to its own set of independent entry points. Unfortunately, this will likely involve a measure of code generation. (Another option would be to use relaxed operations and add appropriate fences.)

lorentey avatar Oct 02 '20 00:10 lorentey