Phase 5: atomics through every layer (RFC 0015)

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.
This commit is contained in:
dev committed 2026-10-06 08:05:01 +03:00
1 parent ce9ef03bc0
commit 4242132b2a
70 files changed
+2630 -80

No files matched your search

+28 -1
View File
@@ -122,7 +122,7 @@ pub fn printType(m: air.Module, t: air.Type, w: *Writer) Writer.Error!void {
},
.region => try w.writeAll("region"),
.scope => try w.writeAll("scope"),
.task, .sender, .receiver, .mutex, .guard, .island, .frozen, .arc, .iref => |inner| {
.task, .sender, .receiver, .mutex, .guard, .island, .frozen, .arc, .iref, .atomic => |inner| {
try w.print("{s}<", .{@tagName(t)});
try printType(m, inner.*, w);
try w.writeByte('>');
@@ -422,6 +422,33 @@ fn printOp(m: air.Module, f: air.Function, op: air.Op, w: *Writer) Writer.Error!
.frozen_borrow => |x| try two(f, w, "frozen.borrow", x.owner, x.iref),
.arc_borrow => |x| try two(f, w, "arc.borrow", x.owner, x.iref),
.iref_eq => |x| try two(f, w, "iref.eq", x.a, x.b),
.atomic_new => |v| try one(f, w, "atomic.new", v),
.atomic_take => |v| try one(f, w, "atomic.take", v),
.atomic_load => |x| {
try w.print("atomic.load.{s} ", .{@tagName(x.ord)});
try value(f, x.cell, w);
},
.atomic_store => |x| {
try w.print("atomic.store.{s} ", .{@tagName(x.ord)});
try value(f, x.cell, w);
try w.writeAll(", ");
try value(f, x.value, w);
},
.atomic_rmw => |x| {
try w.print("atomic.{s}.{s} ", .{ x.op.text(), @tagName(x.ord) });
try value(f, x.cell, w);
try w.writeAll(", ");
try value(f, x.value, w);
},
.atomic_cmpxchg => |x| {
try w.print("atomic.cmpxchg.{s}.{s} ", .{ @tagName(x.success), @tagName(x.failure) });
try value(f, x.cell, w);
try w.writeAll(", ");
try value(f, x.expected, w);
try w.writeAll(", ");
try value(f, x.desired, w);
},
.atomic_fence => |o| try w.print("atomic.fence.{s}", .{@tagName(o)}),
.cap_narrow => |x| {
try w.print("cap.narrow.{s} ", .{x.form});
try value(f, x.cap, w);