atomics A.2a: CAS ops + recognizer + methods, emit bails (lock)
compare_exchange/_weak wired end-to-end except LLVM emission (bails loudly;
A.2b makes it real). New IR op atomic_cmpxchg + AtomicCmpxchg{ptr, cmp, new,
val_ty, success_ordering, failure_ordering, weak}; result type = ?T (null =
SUCCESS, failure carries the actual value for retry). print arm; emit dispatch
-> emitAtomicCmpxchg (BAILS). comptime_vm arm does real single-thread CAS (read
actual / compare / store-on-equal / build ?T: success->none, failure->some;
weak == strong at comptime). Recognizer extended (atomic_cmpxchg/_weak, 6 args)
-- CAS restricted to INTEGER T (loud reject); BOTH orderings resolved via
atomicOrderingFromNode; dual-ordering validation (failure may not be
release/acq_rel nor stronger than success, via atomicOrderingRank). Methods
compare_exchange/_weak on Atomic($T) with comptime $success/$failure: Ordering.
examples/1702 locked to the bail; examples/1186 locks a rejected ordering pair.
Suite green (718/0).
This commit is contained in:
@@ -0,0 +1 @@
|
||||
1
|
||||
@@ -0,0 +1,5 @@
|
||||
error: atomic compare-exchange failure ordering ('.seq_cst') cannot be stronger than the success ordering ('.relaxed')
|
||||
--> /Users/agra/projects/sx/library/modules/std/atomic.sx:79:188
|
||||
|
|
||||
79 | compare_exchange :: (self: *Atomic(T), expected: T, desired: T, $success: Ordering, $failure: Ordering) -> ?T { return atomic_cmpxchg(T, @self.value, expected, desired, success, failure); }
|
||||
| ^^^^^^^
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
1
examples/expected/1702-atomics-cas.exit
Normal file
1
examples/expected/1702-atomics-cas.exit
Normal file
@@ -0,0 +1 @@
|
||||
1
|
||||
3
examples/expected/1702-atomics-cas.stderr
Normal file
3
examples/expected/1702-atomics-cas.stderr
Normal file
@@ -0,0 +1,3 @@
|
||||
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
examples/expected/1702-atomics-cas.stdout
Normal file
1
examples/expected/1702-atomics-cas.stdout
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user