Phase 3: structured tasks and the deterministic scheduler (RFC 0011)

- interpreter core rewritten around explicit per-task frame stacks so a
  task can be suspended at any instruction; behavior of all existing
  tests unchanged
- tasks: scope and task<T> (function-bound; task_transfer and
  task_borrow_returns reserved), spawn/join/cancel/cancelled/scope.end;
  cooperative scheduler with seeded choice rule, separate schedule seed,
  quantum = fuel unit, task limit (limit_exceeded kind tasks), global
  quiescence over waiting tasks; schedule field in the run record
- verifier: Send/Share table (E4001, E4002), loans as task-owned borrows
  (E4302 on early end, E4101 on conflicts), E4301 at scope end, task
  effects (E3101)
- CLI --quantum, --task-limit, --schedule-seed; runner schedules:,
  quantum:, task_limit:, limit_exceeded:
- fixed: schedule seed default used orelse/^ precedence wrongly
- 15 phase-3 conformance tests; 4000 mutants without a crash
- Agent Reference Bundle +10.9 % tokens (recorded)
This commit is contained in:
dev committed 2026-10-04 16:02:03 +03:00
1 parent 2289917af3
commit ab5814a7bb
31 files changed
+1252 -94

No files matched your search

+17
View File
@@ -121,6 +121,12 @@ pub fn printType(m: air.Module, t: air.Type, w: *Writer) Writer.Error!void {
try w.writeByte('>');
},
.region => try w.writeAll("region"),
.scope => try w.writeAll("scope"),
.task => |inner| {
try w.writeAll("task<");
try printType(m, inner.*, w);
try w.writeByte('>');
},
.bool, .void, .never => try w.writeAll(@tagName(t)),
}
}
@@ -330,6 +336,17 @@ fn printOp(m: air.Module, f: air.Function, op: air.Op, w: *Writer) Writer.Error!
try okErr(f, w, x.ok, x.err);
},
.region_reset => |v| try one(f, w, "region.reset", v),
.task_scope_begin => try w.writeAll("task.scope.begin"),
.task_spawn => |x| {
try w.writeAll("task.spawn ");
try value(f, x.scope, w);
try w.print(", @{s}", .{m.functions[x.callee].name});
try values(f, x.args, w);
},
.task_join => |v| try one(f, w, "task.join", v),
.task_cancel => |v| try one(f, w, "task.cancel", v),
.task_cancelled => try w.writeAll("task.cancelled"),
.task_scope_end => |v| try one(f, w, "task.scope.end", v),
.region_destroy => |v| try one(f, w, "region.destroy", v),
.cap_narrow => |x| {
try w.print("cap.narrow.{s} ", .{x.form});