AIR: linear atomic<T> (AtomicScalar), atomic.new/take/load/store/RMW/ cmpxchg (two results)/fence with explicit orderings; feature atomics published. Verifier: ordering tables (E4201), ordinary access (E4202), effects [atomic] / [atomic, atomic.weak], linearity, take while lent (E4101, also for mutex.take). Interpreter: timestamped message machine (src/interp/weak.zig); views travel through spawn/join, channels, mutexes, close and cancel; seq_cst reads the latest message and programs without weak reads make no extra draw (existing records unchanged). aji explore: exhaustive exploration that branches only before visible operations. Litmus: 20/20 tests give exactly the oracle's sets; differential test (1500 random programs) found no unsound outcome. .aji layer 10, Quick Reference atomics, source coverage 67/67, audit report atomic_operations. AIR bundle +5.9 %, QUICK.md +0.5k.
29 lines
663 B
LLVM
29 lines
663 B
LLVM
; atomic.take while the cell is lent to a live task is a race (spec 04 §28).
|
|
; expect: reject E4101
|
|
; phase: 5
|
|
; spec: docs/spec/04-concurrency-and-atomics.md
|
|
module test.take_while_lent
|
|
air 0
|
|
lang 0.1
|
|
features [atomics, cancellation, effects, ownership, tasks]
|
|
|
|
fn @reader(%c: ref<atomic<u64>>) -> u64
|
|
effects [atomic]
|
|
entry:
|
|
%x = atomic.load.seq_cst %c
|
|
ret %x
|
|
|
|
fn @main() -> u64
|
|
effects [atomic, task.spawn, task.wait]
|
|
entry:
|
|
%z = const.u64 0
|
|
%c = atomic.new %z
|
|
%r = borrow.ref %c
|
|
%s = task.scope.begin
|
|
%t = task.spawn %s, @reader(%r)
|
|
%v = atomic.take %c
|
|
%x = task.join %t
|
|
task.scope.end %s
|
|
borrow.end %r
|
|
ret %v
|