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

+14
View File
@@ -16,6 +16,20 @@ pub fn check(c: *Context) !void {
if (!m.declares("effects")) return;
for (m.functions) |f| {
for (f.blocks) |b| for (b.insts) |inst| switch (inst.op) {
.task_spawn => |x| {
if (!contains(f.effects, "task.spawn")) try c.report("E3101", inst.span, "task.spawn requires the effect task.spawn", &.{
.{ .name = "function", .value = .{ .str = f.name } },
.{ .name = "effect", .value = .{ .str = "task.spawn" } },
});
const callee = m.functions[x.callee];
for (callee.effects) |e| if (!std.mem.eql(u8, e, "unsafe") and !contains(f.effects, e)) {
try c.report("E3101", inst.span, "task function effect not declared by the spawning function", &.{
.{ .name = "function", .value = .{ .str = f.name } },
.{ .name = "callee", .value = .{ .str = callee.name } },
.{ .name = "effect", .value = .{ .str = e } },
});
};
},
.call => |x| {
const callee = m.functions[x.callee];
// `unsafe` is checked by the unsafe stage, which knows about