- src/interp/machine.zig: format-0 interpreter on the air64 target; checked/wrapping arithmetic, shifts, casts, aggregates, calls with a 1024-frame limit, traps as records with T0xxx codes - aji run: prints one JSON run record; exit code 4 on trap - conformance runner: `expect: run` with `result:`/`trap:`, every run executed twice and compared byte-for-byte; header keys must be single lowercase words - Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
34 lines
567 B
LLVM
34 lines
567 B
LLVM
; Recursive calls, void callees and never-returning functions.
|
|
; expect: accept
|
|
; phase: 0
|
|
; spec: docs/spec/07a-air-instructions.md
|
|
module test.recursion_and_void_calls
|
|
air 0
|
|
lang 0.1
|
|
features []
|
|
|
|
fn @fact(%n: u64) -> u64
|
|
effects []
|
|
entry:
|
|
%one = const.u64 1
|
|
%base = le.u64 %n, %one
|
|
cbr %base, @done(), @step()
|
|
done:
|
|
ret %one
|
|
step:
|
|
%m = sub.checked.u64 %n, %one
|
|
%r = call @fact(%m)
|
|
%p = mul.checked.u64 %n, %r
|
|
ret %p
|
|
|
|
fn @check(%c: bool) -> void
|
|
effects []
|
|
entry:
|
|
assert %c
|
|
ret
|
|
|
|
fn @fail() -> never
|
|
effects []
|
|
entry:
|
|
trap
|