- 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)
95 lines
2.3 KiB
LLVM
95 lines
2.3 KiB
LLVM
; Every task waits and no event can wake one: the run is blocked.
|
|
; expect: run
|
|
; grant: listen=net.listen
|
|
; blocked: no_future_event
|
|
; phase: 3
|
|
; spec: docs/spec/04-concurrency-and-atomics.md
|
|
module test.tasks_join_deadlock
|
|
air 0
|
|
lang 0.1
|
|
features [arrays, capabilities, effects, ownership, resources, tasks]
|
|
|
|
fn @main(%listen: cap<net.listen>) -> void
|
|
effects [task.spawn, net.listen]
|
|
entry:
|
|
%sc = task.scope.begin
|
|
%t = task.spawn %sc, @serve(%listen)
|
|
task.join %t
|
|
task.scope.end %sc
|
|
ret
|
|
|
|
fn @serve(%listen: cap<net.listen>) -> void
|
|
effects [net.listen]
|
|
entry:
|
|
%a = local.alloc array<u8, 11>
|
|
local.zero %a
|
|
%am = borrow.mut %a
|
|
%ai0 = const.usize 0
|
|
%ac0 = const.u8 49
|
|
%ae0 = borrow.index %am, %ai0
|
|
store %ae0, %ac0
|
|
borrow.end %ae0
|
|
%ai1 = const.usize 1
|
|
%ac1 = const.u8 50
|
|
%ae1 = borrow.index %am, %ai1
|
|
store %ae1, %ac1
|
|
borrow.end %ae1
|
|
%ai2 = const.usize 2
|
|
%ac2 = const.u8 55
|
|
%ae2 = borrow.index %am, %ai2
|
|
store %ae2, %ac2
|
|
borrow.end %ae2
|
|
%ai3 = const.usize 3
|
|
%ac3 = const.u8 46
|
|
%ae3 = borrow.index %am, %ai3
|
|
store %ae3, %ac3
|
|
borrow.end %ae3
|
|
%ai4 = const.usize 4
|
|
%ac4 = const.u8 48
|
|
%ae4 = borrow.index %am, %ai4
|
|
store %ae4, %ac4
|
|
borrow.end %ae4
|
|
%ai5 = const.usize 5
|
|
%ac5 = const.u8 46
|
|
%ae5 = borrow.index %am, %ai5
|
|
store %ae5, %ac5
|
|
borrow.end %ae5
|
|
%ai6 = const.usize 6
|
|
%ac6 = const.u8 48
|
|
%ae6 = borrow.index %am, %ai6
|
|
store %ae6, %ac6
|
|
borrow.end %ae6
|
|
%ai7 = const.usize 7
|
|
%ac7 = const.u8 46
|
|
%ae7 = borrow.index %am, %ai7
|
|
store %ae7, %ac7
|
|
borrow.end %ae7
|
|
%ai8 = const.usize 8
|
|
%ac8 = const.u8 49
|
|
%ae8 = borrow.index %am, %ai8
|
|
store %ae8, %ac8
|
|
borrow.end %ae8
|
|
%ai9 = const.usize 9
|
|
%ac9 = const.u8 58
|
|
%ae9 = borrow.index %am, %ai9
|
|
store %ae9, %ac9
|
|
borrow.end %ae9
|
|
%ai10 = const.usize 10
|
|
%ac10 = const.u8 57
|
|
%ae10 = borrow.index %am, %ai10
|
|
store %ae10, %ac10
|
|
borrow.end %ae10
|
|
borrow.end %am
|
|
%ar = borrow.ref %a
|
|
%as = slice.make %ar
|
|
intrinsic net.listen(%listen, %as), ok -> @listening, err -> @fail
|
|
listening(%l: listener):
|
|
%lm = borrow.mut %l
|
|
intrinsic net.accept(%lm), ok -> @accepted, err -> @fail2
|
|
accepted(%st: stream):
|
|
trap
|
|
fail2(%e2: io_error):
|
|
trap
|
|
fail(%e: io_error):
|
|
trap
|