Skip to content

Commit

Permalink
Prevent CSE optimization on fenceless_get operations
Browse files Browse the repository at this point in the history
  • Loading branch information
polytypic committed Dec 23, 2023
1 parent ea53867 commit f8d1155
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Multicore_magic.ml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include Padding
module Transparent_atomic = Transparent_atomic

let[@inline] fenceless_get (atomic : 'a Atomic.t) = !(Obj.magic atomic : 'a ref)
let[@inline] fenceless_get (atomic : 'a Atomic.t) =
!(Sys.opaque_identity (Obj.magic atomic : 'a ref))

let[@inline] fenceless_set (atomic : 'a Atomic.t) value =
(Obj.magic atomic : 'a ref) := value
Expand Down

0 comments on commit f8d1155

Please sign in to comment.