atomics A.2b: real CAS emission (cmpxchg) + unit test (green)
emitAtomicCmpxchg: LLVMBuildAtomicCmpXchg (success/failure orderings,
singleThread=0) returns a {T, i1} pair; LLVMSetWeak for the weak variant. The
sx ?T result (null = SUCCESS) is built as { extractvalue 0 (actual value),
xor(extractvalue 1 (success), true) } -- has_value = NOT success. Integer-only
(recognizer guard), so never a pointer/niche optional.
examples/1702 green: successful CAS returns null (value updated), failing CAS
returns the actual value (unchanged), weak retry loop increments a counter
(100 -> 105). LLVM IR shows `cmpxchg ... acq_rel acquire` and `cmpxchg weak`.
Unit test `emit: atomic cmpxchg (strong + weak)` locks `cmpxchg` + the weak
marker. Suite green (718/0).
This commit is contained in:
@@ -1 +1 @@
|
||||
1
|
||||
0
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
error: atomic compare-exchange LLVM emission not yet implemented (Stream A, A.2b)
|
||||
error: atomic compare-exchange LLVM emission not yet implemented (Stream A, A.2b)
|
||||
error: atomic compare-exchange LLVM emission not yet implemented (Stream A, A.2b)
|
||||
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
|
||||
cas ok, now: 20
|
||||
cas failed, actual: 20, still: 20
|
||||
after loop: 105
|
||||
|
||||
Reference in New Issue
Block a user