- 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)
33 lines
607 B
LLVM
33 lines
607 B
LLVM
; A borrow of a task handle cannot be sent to another task.
|
|
; expect: reject E4001
|
|
; phase: 3
|
|
; spec: docs/spec/04-concurrency-and-atomics.md
|
|
module test.tasks_not_send
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, ownership, tasks]
|
|
|
|
fn @main() -> void
|
|
effects [task.spawn]
|
|
entry:
|
|
%sc = task.scope.begin
|
|
%t = task.spawn %sc, @noop()
|
|
%tm = borrow.mut %t
|
|
%u = task.spawn %sc, @hold(%tm)
|
|
task.join %u
|
|
borrow.end %tm
|
|
%r = task.join %t
|
|
task.scope.end %sc
|
|
ret
|
|
|
|
fn @noop() -> u8
|
|
effects []
|
|
entry:
|
|
%z = const.u8 0
|
|
ret %z
|
|
|
|
fn @hold(%x: mut<task<u8>>) -> void
|
|
effects []
|
|
entry:
|
|
ret
|