Files
aji/tests/conformance/phase2/run/accept_blocks.air
T
dev d405d4ea50 Phase 2: I/O intrinsics, linear resources, deterministic profile (RFC 0007)
- air: resource types file<read|write|append>, listener, stream; io_error;
  intrinsic registry (19 intrinsics) synced with reference/intrinsics.md;
  fallible intrinsics as ok/err terminators; fs prefix narrowing;
  linear_aggregates gating
- verifier: intrinsic form, operand, result and capability-kind checks
  (E1001, E3201, E5002); intrinsic effects (E3101); resource linearity
  in the borrow walker with per-edge moves: E3002 leaks and join
  mismatches, E3001, E2001, E2002, E2101 for close while borrowed;
  resources as borrow roots
- interp: deterministic world (captured console, VFS, loopback TCP,
  instruction clock, pinned xoshiro256 PRNG), blocked outcome, run
  record with stdout/stderr/files
- CLI: --stdin, --vfs, --seed, --result-file, --profile (hosted: exit 3),
  exit code 7; runner: stdin/vfs/seed/stdout/stderr/file/blocked headers
- conformance: hello, file copy and TCP echo exit programs; 37 new tests;
  4000 mutants without a crash
2026-10-04 14:02:17 +03:00

86 lines
2.5 KiB
LLVM

; accept with no pending connection and no other execution unit: the run is blocked, not an io_error.
; expect: run
; grant: listen=net.listen
; blocked: no_future_event
; phase: 2
; spec: docs/spec/11-determinism-and-replay.md
module test.accept_blocks
air 0
lang 0.1
features [arrays, capabilities, effects, ownership, resources]
fn @main(%listen: cap<net.listen>) -> void
effects [net.listen]
entry:
%addr = local.alloc array<u8, 11>
local.zero %addr
%addr_m = borrow.mut %addr
%addr_i0 = const.usize 0
%addr_c0 = const.u8 49
%addr_e0 = borrow.index %addr_m, %addr_i0
store %addr_e0, %addr_c0
borrow.end %addr_e0
%addr_i1 = const.usize 1
%addr_c1 = const.u8 50
%addr_e1 = borrow.index %addr_m, %addr_i1
store %addr_e1, %addr_c1
borrow.end %addr_e1
%addr_i2 = const.usize 2
%addr_c2 = const.u8 55
%addr_e2 = borrow.index %addr_m, %addr_i2
store %addr_e2, %addr_c2
borrow.end %addr_e2
%addr_i3 = const.usize 3
%addr_c3 = const.u8 46
%addr_e3 = borrow.index %addr_m, %addr_i3
store %addr_e3, %addr_c3
borrow.end %addr_e3
%addr_i4 = const.usize 4
%addr_c4 = const.u8 48
%addr_e4 = borrow.index %addr_m, %addr_i4
store %addr_e4, %addr_c4
borrow.end %addr_e4
%addr_i5 = const.usize 5
%addr_c5 = const.u8 46
%addr_e5 = borrow.index %addr_m, %addr_i5
store %addr_e5, %addr_c5
borrow.end %addr_e5
%addr_i6 = const.usize 6
%addr_c6 = const.u8 48
%addr_e6 = borrow.index %addr_m, %addr_i6
store %addr_e6, %addr_c6
borrow.end %addr_e6
%addr_i7 = const.usize 7
%addr_c7 = const.u8 46
%addr_e7 = borrow.index %addr_m, %addr_i7
store %addr_e7, %addr_c7
borrow.end %addr_e7
%addr_i8 = const.usize 8
%addr_c8 = const.u8 49
%addr_e8 = borrow.index %addr_m, %addr_i8
store %addr_e8, %addr_c8
borrow.end %addr_e8
%addr_i9 = const.usize 9
%addr_c9 = const.u8 58
%addr_e9 = borrow.index %addr_m, %addr_i9
store %addr_e9, %addr_c9
borrow.end %addr_e9
%addr_i10 = const.usize 10
%addr_c10 = const.u8 57
%addr_e10 = borrow.index %addr_m, %addr_i10
store %addr_e10, %addr_c10
borrow.end %addr_e10
borrow.end %addr_m
%addr_r = borrow.ref %addr
%addr_s = slice.make %addr_r
intrinsic net.listen(%listen, %addr_s), ok -> @listening, err -> @fail
listening(%l: listener):
%lm = borrow.mut %l
intrinsic net.accept(%lm), ok -> @accepted, err -> @fail2
accepted(%s: stream):
trap
fail(%e: io_error):
trap
fail2(%e2: io_error):
trap