Commit Graph

35077 Commits

Author SHA1 Message Date
ed14dabd54 sema: enable 62 more corpus tests
Enable std lib tests for crypto (pcurves, aes, siphash, keccak,
ghash, scrypt, edwards25519, tls), os/linux (x86, x86_64, mips,
powerpc, sparc64, io_uring, tls), os/uefi, os/windows, Thread
(Condition, RwLock), math (nextafter, pow, gamma, atan2, float),
hash (crc, murmur, cityhash, auto_hash), compress/flate, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:02:04 +00:00
3730604656 sema: enable 75 more corpus tests
Enable large batch of std lib tests: crypto (aes, sha1, ascon, md5,
poly1305, x25519, curve25519, pbkdf2, timing_safe, asn1),
Thread (Pool, Mutex, RwLock, ResetEvent), math (pow, atan, atan2,
gamma, expm1, frexp, ldexp, powi, log1p, float), os/linux (aarch64,
s390x, loongarch64, arm, mips, mips64, powerpc, sparc64, seccomp),
os/uefi, os/windows, compress, dwarf, hash, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 19:00:21 +00:00
47485582df sema: enable 97 more corpus tests
Enable large batch of std lib tests that pass with existing C sema
capabilities: dwarf, math, uefi, crypto, Target, Random, compress,
os/linux, os/windows, fmt, hash, Io, and more.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:58:37 +00:00
7b1c692dae sema: enable 24 more corpus tests (dwarf, math, uefi, etc.)
Enable tests for files that produce no exported functions or match
existing C sema capabilities: dwarf/FORM, dwarf/ATE, dwarf/LANG,
math/iszero, math/signbit, math/isnan, math/isinf, math/isnormal,
math/log2, math/gcd, uefi/simple_file_system, uefi/hii_popup,
uefi/loaded_image, uefi/simple_text_input, uefi/service_binding,
uefi/simple_pointer, uefi/hii, crypto/errors, hash/fnv,
os/plan9/x86_64, os/freebsd, os/linux/ioctl, valgrind/cachegrind,
once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:56:17 +00:00
7cedd3fe9a sema: add comptime condbr, enable 15 new corpus tests
- Handle comptime-known conditions in condbr (BOOL_TRUE/BOOL_FALSE)
  by analyzing only the taken branch, matching upstream Sema.zig.
- Fix CoveragePoint encoding in branch_hints (1-bit enum, not 2-bit).
- Enable corpus tests: btf_ext, abs, arg, conj, scalbn, SplitMix64,
  shell_parameters, EH, generic, crypt32, isfinite, copysign.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:48:08 +00:00
061353e55d sema: enable absvsi2.zig and absvti2.zig corpus tests
Same absv pattern as absvdi2, just with i32 and i128.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:25:55 +00:00
76318b0c54 sema: enable absvdi2.zig — add switch_block, inline calls, condbr, panic
Port multiple sema handlers needed for the absv pattern:
- zirSwitchBlockComptime: reserve dead BLOCK+BR for comptime switch
- zirCondbr with branch_hints (CoveragePoint 1-bit encoding)
- findDeclImportFieldVal for cross-module field_val resolution
- block_inline with need_debug_scope tracking
- alloc_mut, store_node, dbg_var_val, block, condbr, trap handlers
- Test fixes: TRAP/UNREACH/BREAKPOINT as no_op in AIR comparison

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:24:32 +00:00
549bfd509e sema: add alloc, block, condbr, store, call, panic handlers for absv pattern
Add handlers needed for cross-module inline calls with control flow
(absv.zig pattern): alloc_mut, store_node, block, condbr, panic,
call (for @panic → builtin.call), unreach, dbg_var_ptr, alloc in
semaTypeOf, mergesAppend, findBlockLabel, and extended semaCoerce
for signed int types.

absvdi2.zig still needs more work (semaCoerce for additional type
combinations).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:51:53 +00:00
a0ca867ad3 sema: add f80/f128 support to floatTypeBits, enable negxf2.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:32:40 +00:00
cf4fcb60c2 sema: enable neghf2.zig with cross-module comptime evaluation
Implement comptime evaluation of fneg's body from common.zig:
- block_comptime handler: evaluate body, map break_inline result
- typeof/typeof_builtin: resolve to param type for anytype
- type_info: extract float bits from type
- field_val: comptime field access on type_info results
- reify/struct_init/decl_literal: reconstruct int type from bits
- as_node/bitcast: handle comptime-resolved type refs
- dbg_var_val: skip comptime-only values (types, comptime_int)
- int_comptime handler for cross-module comptime integer literals

neghf2.zig corpus test now passes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:29:06 +00:00
b3cf6644a7 sema: add cross-module ZIR loading infrastructure for inline calls
Add source_dir to Sema for resolving relative imports. When a
field_call cannot find its callee locally, attempt cross-module
resolution: extract import path from the declaration's value body,
load and parse the imported file, generate its ZIR, and find the
target function.

Also add comptime tracker, comptime handlers (zirTypeof,
zirTypeInfoComptime, zirFieldValComptime), explicit handlers for
RET_TYPE (with TYPE_NONE guard) and SAVE_ERR_RET_INDEX (void mapping),
and source_dir wiring in stages_test.zig.

neghf2.zig still needs comptime @Type/reify + struct_init support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 15:50:59 +00:00
f1dde74a15 sema: add inline function call support and declaration table
Port same-file inline function call infrastructure from upstream:
- parseFuncZir to extract ZIR body/ret-type info for func/func_fancy
- zirCall for same-file inline function calls (decl_val → func lookup →
  inline body analysis with dbg_inline_block, dbg_arg_inline, br)
- Declaration table (decl_names/decl_insts) built by zirStructDecl
- decl_val/decl_ref dispatch, field_call dispatch
- restore_err_ret_index as no-op
- DBG_INLINE_BLOCK/BLOCK in semaTypeOf
- DBG_INLINE_BLOCK extra canonicalization in test comparison

Add unit tests: same-file inline call, inline call with bitcast+xor,
inline call with two args.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:57:39 +00:00
6379a0f753 skill 2026-02-20 16:53:52 +02:00
f4635b5ac0 sema: add wrapping ops, bool_not, float/int casts, bit counting, byte_swap
New ZIR handlers:
- addwrap/subwrap/mulwrap → AIR add_wrap/sub_wrap/mul_wrap
- negate_wrap → AIR sub_wrap(0, operand)
- bool_not → AIR not(bool, operand)
- float_cast → AIR fpext or fptrunc (width comparison)
- int_from_float, float_from_int → AIR ty_op casts
- clz, ctz, pop_count → AIR ty_op with computed result type
- byte_swap → AIR ty_op(operand_ty, operand)

Infrastructure improvements:
- semaCoerce: handle runtime int→int coercion via AIR intcast
- ret_node: use semaCoerce instead of coerceIntRef for full coercion
- Return type resolution: handle 2-instruction ptr_type bodies
- func_fancy: properly track ret_ty_body_len and ret_ty_ref_pos
- semaTypeOf: add wrapping ops, cmp, load, not, float/int casts, bit ops
- airDataRefSlots: fix LOAD/NOT classification (ty_op not un_op),
  add wrap ops, float/int casts, bit count ops
- zirAsShiftOperand: pass block for proper coercion support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:31:45 +00:00
befd8456c3 skill: run workers in background for real-time monitoring
Add run_in_background=true to worker dispatch so the user can
tail -f the output file to observe the worker's full transcript
(tool calls, reasoning, output) in real time.

Changes:
- Add TaskOutput to allowed-tools
- Add "Monitoring Workers" section with tail -f instructions
- Update Step 3 to use run_in_background=true and TaskOutput

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:12:09 +00:00
71596c10ad sema: add store, compare, ptr_type param, and validate_* handlers
New ZIR instruction handlers:
- STORE_NODE: store value to pointer (bin_op with coercion)
- CMP_LT/LTE/EQ/GTE/GT/NEQ: comparison operations
- VALIDATE_DEREF, VALIDATE_CONST: no-op validation (skip in body)

Infrastructure:
- ptrChildType: extract child type from pointer type
- Extend param type body resolution to handle ptr_type + break_inline
  (2-instruction type body, e.g. *u32 param)
- Fix PARAM dispatch: skip without overwriting inst_map (was clobbering
  arg mapping set by zirFunc)

New tests: pointer param identity, store to pointer, compare lt/eq,
f32 arithmetic, multi-param, nested bitcast xor, sub comptime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 14:05:18 +00:00
10ff356d92 skill: update enable-tests to never skip, always drill down
Instead of skipping/commenting out tests when they need complex features,
the worker now decomposes the problem into smaller pieces:
- Analyze missing ZIR instructions via ast-check -t
- Add minimal unit tests in the appropriate test file (e.g. sema_test.zig)
- Implement one handler at a time, keeping unit tests green
- Build up from simple to compound constructs
- Re-enable the corpus test only when all pieces work

Key changes to orchestrator:
- Add "Unit test file" column to file configuration table
- Add "Drill-Down Strategy" section
- stages_test.zig now includes sema_test.zig in git-add list
- progress commits include unit tests + handlers

Key changes to worker:
- Add full "Drill-Down Strategy" section with examples
- Never skip/comment out a test — decompose instead
- Each iteration must produce at least one passing unit test
- Unit test file always stays green

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:57:38 +00:00
ad7aead47d sema: add mul, intcast, truncate, shl/shr, dbg_var_val handlers
Add new ZIR instruction handlers for:
- MUL (dispatch to existing zirArithmetic)
- INT_CAST, TRUNCATE (new zirTyOpCast generic handler)
- SHL, SHR (new zirShl handler)
- TYPEOF_LOG2_INT_TYPE, AS_SHIFT_OPERAND (shift type infrastructure)
- DBG_VAR_VAL, DBG_VAR_PTR (debug variable annotations)

Infrastructure additions:
- semaAppendAirString: stores NullTerminatedString in AIR extra array
- zirTypeofLog2IntType: computes log2 integer type for shift amounts
- zirAsShiftOperand: coerces shift operand to correct type
- Extend semaTypeOf for MUL, SHL, SHR, INTCAST, TRUNC tags
- Normalize NTS padding in test comparison (Zig leaves trailing
  bytes uninitialised; the C side zeroes them)

New tests: dbg_var_val, mul, intcast, truncate, shl, shr, chain of
casts, mixed arithmetic+bitwise, shift+mask, neghf2-equivalent.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:51:40 +00:00
456a50694d sema: add arithmetic, bitwise, @bitCast, and @as handlers
Port binary operation infrastructure from upstream Sema.zig:
- semaTypeOf: resolve AIR ref types (IP refs and inst refs)
- resolvePeerType: peer type resolution (same type, comptime_int)
- semaCoerce: type coercion (pass-through, comptime_int)
- zirArithmetic: add/sub → AIR bin_op
- zirBitwise: xor/bit_and/bit_or → AIR bin_op
- zirBitcast: @bitCast → AIR ty_op
- zirAsNode: @as → pure coercion

Fix airDataRefSlots: move BITCAST from un_op to ty_op group.

Add 9 new C-vs-Zig AIR comparison tests including a neghf2
inline equivalent that produces the exact runtime AIR ops
(bitcast f16→u16, xor 0x8000, bitcast u16→f16).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:11:47 +00:00
21b91fb556 verbose_air: add callback_count canary to detect skipped sema
Defense-in-depth for the cache_mode fix: track how many times the
verbose_air_callback fires and fail the test if C sema produced
functions but the Zig callback was never invoked.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 13:20:21 +02:00
2aecdf98e0 sema: handle @export builtin and ZIR_INST_FUNC_FANCY
Add three pieces of support needed for compiler_rt corpus files that
use @export to make functions visible:

- ZIR_INST_EXPORT handler in analyzeBodyInner: when processing a
  comptime block containing @export, extract the target declaration
  name from the ZIR_INST_DECL_REF/DECL_VAL instruction and record it
  for later use by zirFunc.

- ZIR_INST_FUNC_FANCY payload parsing in zirFunc: functions with
  explicit calling conventions (callconv(.c)) use func_fancy instead
  of func/func_inferred. Parse the different extra layout
  {param_block, body_len, bits} with optional trailing cc, ret_ty,
  and noalias fields.

- Export-aware function filtering: zirFunc now checks both the
  declaration-level export flag and the @export-collected names list
  when deciding whether to analyze a function body.

The exported compiler_rt functions are now found and analyzed, but
their bodies produce fewer AIR instructions than Zig because the C
sema does not yet implement imports, field access, or function calls.
Corpus test comments updated to reflect new status.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 11:20:16 +00:00
67235b6c72 verbose_air: use incremental cache mode to avoid stale results
With .cache_mode = .whole, comp.update() returns immediately on a
cache hit, skipping sema entirely.  The verbose_air_callback never
fires, so the collector returns 0 functions.  This causes spurious
test passes when the C sema also returns 0 functions (e.g. for
unported @export), because 0 == 0 looks like a match.

Switch to .incremental so that sema always runs and the callback
always fires, making test results deterministic across runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:49:46 +00:00
052b4ac4bd fmt and remove some comments 2026-02-20 12:33:48 +02:00
00f48fa2f9 sema: port parameter handling for identity function
Port getParamBody (from Zir.zig) and parameter processing in zirFunc
(from PerThread.zig analyzeFnBodyInner) to handle function parameters.
For each param, resolves the type from the param's type body and emits
AIR_INST_ARG instructions mapped to the param ZIR instructions.

Also adds explicit handling for ZIR_INST_PARAM (mapped to void at
module level) and ZIR_INST_RESTORE_ERR_RET_INDEX_FN_ENTRY (no-op in
ReleaseFast) in analyzeBodyInner.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:27:26 +00:00
67f4770835 sema_test: compare AIR data per-instruction using tag-aware sizes
Move padding awareness from collection (verbose_air.zig) to the test
comparison (sema_test.zig).  Air.Inst.Data is an 8-byte union where
some variants (un_op, no_op, ty, repeat) use fewer bytes; the rest is
uninitialised padding.  Instead of zeroing padding at collection time,
compare only the meaningful bytes per tag in the test harness.

This reverts the verbose_air.zig zeroing from 67b821e925 and
replaces the bulk std.mem.eql in airCompareOne with a per-instruction
loop that also gives better diagnostics on mismatch (instruction
index, tag, byte count).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 10:24:33 +00:00
e8c04d4507 sema: port ret_node and fix AIR tag storage type
Three issues fixed to enable the "return integer" test
(export fn f() u32 { return 42; }):

1. AIR tag storage: AirInstTag was a C enum (4 bytes) but the Zig-side
   CAir expects u8 (matching Air.Inst.Tag = enum(u8)). The byte-for-byte
   comparison read padding bytes instead of subsequent tags. Fixed by
   storing tags as uint8_t in Air and Sema structs.

2. New ZIR_INST_RET_NODE handler: resolves the operand, coerces from
   comptime_int to the function return type via coerceIntRef, and emits
   AIR_INST_RET.

3. Return type resolution in zirFunc: reads the actual return type from
   ZIR extra data (ret_ty_body_len == 1) instead of hardcoding void.

Also rewrites the AIR datas comparison to be tag-aware with canonical
ref renumbering, so structurally equivalent AIR compares equal even
when InternPool indices differ between C and Zig.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 09:48:45 +00:00
67b821e925 verbose_air: zero padding in Air.Inst.Data when collecting
Air.Inst.Data is a union; variants smaller than 8 bytes (un_op,
no_op, ty, repeat) leave padding bytes uninitialised.  Zero the
destination buffer and copy only the meaningful bytes per instruction
so that byte-level comparisons in tests are deterministic and
valgrind-clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:42:53 +00:00
b359a8d5f8 fmt 2026-02-20 10:30:47 +02:00
a787650d54 verbose_air: use caller-provided error buffer instead of heap allocation
Replace the heap-allocated error_msg with a fixed-size caller-provided
buffer, making error reporting infallible. All error paths now write
into the buffer via bufPrint with truncation on overflow.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:11:17 +00:00
a560752410 sema: port zirFunc for exported void functions
Port zirFunc to C sema so that `export fn f() void {}` produces
matching AIR on both the C and Zig sides. Configure verbose_air.zig
to use the self-hosted wasm backend (use_llvm=false) with ReleaseFast,
which eliminates error tracing and safety-check instructions.

Enable the "sema air: empty void function" test case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 08:04:00 +00:00
d371303f4f verbose_air: enable emit_bin so exported functions produce AIR
With emit_bin=false, the compiler never queued functions for analysis,
making the verbose_air_callback a no-op — all corpus files produced 0
AIR functions on both C and Zig sides, so Stage 3 comparison was
vacuous.

Set emit_bin=true so that `export fn` and `@export` trigger function
analysis. Disable 5 compiler_rt corpus files that now expose the
Zig-vs-C mismatch (they use @export but C sema doesn't port zirFunc
yet). Add 3 skipped export-fn test tiers in sema_test.zig as targets
for incremental zirFunc porting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 07:22:20 +00:00
02ff3b93fe verbose_air: fix index-out-of-bounds when shrinking func collector array
Use allocatedSlice() instead of .items to get the full [0..capacity]
slice for realloc. .items only covers [0..len] which causes an
out-of-bounds access when capacity > len.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:18:33 +00:00
9ae160a5f2 use wasi target 2026-02-19 22:13:41 +00:00
bdf753eaf8 Move Air comparison from src/ to stage0/
src/verbose_air.zig now only collects Air data (zig_compile_air) instead
of comparing it (zig_compare_air). The comparison logic lives in
stage0/sema_test.zig, keeping testing infrastructure in stage0/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 21:58:08 +00:00
5ee105ffac update skill 2026-02-19 21:56:40 +00:00
9e4e036ba4 stages_test: enable llvm.zig, p256/field.zig, secp256k1/field.zig
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 21:51:01 +00:00
7189403042 zig_compare_air: add module_root parameter to widen import resolution
Hardcoding the module root to dirname(src_path) caused "import of file
outside module path" for any @import("../...") in corpus files. Add an
optional module_root parameter so stages_test can symlink to the repo
root, allowing all relative imports to resolve within the module path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 21:34:39 +00:00
507867a480 remove some leftover exports 2026-02-19 21:21:05 +00:00
0259a61152 disable debug logging 2026-02-19 21:05:41 +00:00
e0ee116eaf always build with valgrind 2026-02-19 20:58:30 +00:00
e6f2e640dc Fix test-zig0 cache invalidation on every commit
The git-describe version string (including commit hash) was passed via
exe_options to zig_internals_mod, causing verbose_dumper to recompile
(~7 min) after every commit. Create separate zig0_exe_options with a
fixed version "0.15.2-zig0-dev" for test-zig0/all-zig0 targets.

Also verify matched_count against c_func_count in Air comparisons to
catch spurious extra functions from the C pipeline.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 20:22:51 +00:00
da5a9a382b enable-tests skill: warn about src/ modification cost
Changing src/ files invalidates the verbose_dumper cache, triggering a
~7 minute recompilation. Document this in both orchestrator and worker
prompts, with the alternative of using --verbose-air.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 20:22:51 +00:00
63a4e708ee stages_test: use directory symlink for Air comparison source files
Instead of writing file content to /tmp (which broke relative imports
like codecs/asn1.zig), symlink the original file's directory into
.zig-cache/tmp/zig0_test. This keeps the module root outside lib/std/
(avoiding module path conflicts) while preserving subdirectory import
resolution through the symlink.

In verbose_air.zig, use Compilation.Path.fromUnresolved to construct the
module root so it gets the same canonical root enum (.local_cache, etc.)
as file paths computed during import resolution, avoiding isNested
root mismatches.

Fixes the codecs.zig test failure (434/434 tests now pass).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 19:13:08 +00:00
882ad78257 Remove unimplemented InternPool dump stubs
Both zig_dump_intern_pool and c_dump_intern_pool were unimplemented stubs
with no callers. InternPool correctness is validated by unit tests and Air
comparison.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 18:32:46 +00:00
e275e9bb76 Replace copy-based Air export with zero-copy in-place comparison
Pass C-side SemaFuncAir arrays into zig_compare_air so the callback
can compare Air tags/datas/extra directly against the Zig compiler's
in-memory arrays, eliminating 4 heap allocations + 3 memcpys per
function.

Fix the early-return guard in PerThread.zig to also check
verbose_air_callback, so the callback fires even when
enable_debug_extensions is false (ReleaseFast).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 17:57:58 +00:00
59b11a3be4 Replace text-based Air comparison with raw array memcmp
Export raw Air arrays (tags, datas, extra) from the Zig compiler via a
RawAirCallback on Compilation, and memcmp them against C-produced arrays
instead of comparing formatted text output. This is more robust (catches
any byte-level divergence) and eliminates the need for the C-side text
formatter.

- Add RawAirCallback type and field to Compilation
- Rewrite src/verbose_air.zig: raw array export instead of text capture
- Update stage0 tests to use compareAir with expectEqualSlices
- Delete stage0/verbose_air.{c,h} (no longer needed)
- Remove verbose_air.c/h from build.zig file lists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 16:52:58 +00:00
9adc6fb5fe Replace structural Air/IP comparison with text-based dumpers
Remove all @import("zig_internals") from stage0/ so that test_obj
compilation is independent of the Zig compiler (~6min). The sema
comparison now uses text-based dumpers:

- Zig side (src/verbose_air.zig): compiles source through the full Zig
  pipeline, captures verbose_air output, exports zig_dump_air() as a C
  function. Compiled as a separate dumper_obj that is cached
  independently.

- C side (stage0/verbose_air.c): formats C Air structs to text in the
  same format as Zig's Air/print.zig.

Changing stage0 code no longer triggers Zig compiler recompilation:
C compile + cached test_obj + cached dumper + link = seconds.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 14:48:40 +00:00
47c9dd8636 stages_test: full per-function Air comparison between C and Zig sema
Replace the count-only check with a faithful textual comparison,
analogous to how expectEqualZir compares AstGen output:

- Export Zcu from test_exports so tests can construct a PerThread
- Parse Zig verbose_air output into per-function sections keyed by FQN
- For each C function Air, render it as text via air.write() using
  the Zig PerThread (InternPool indices must match between C and Zig
  for the same source), then compare against the Zig reference text

For the current corpus (codecs.zig, no functions), both sides produce
zero entries so the comparison loop is empty. When zirFunc is ported
and a corpus file with functions is added, this will exercise real
per-function Air matching.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 13:04:30 +00:00
5d05f3633f stages_test: compare per-function Air count between C and Zig sema
Parse the captured Zig verbose_air output to count per-function Air
sections and verify that C sema produces the same number. For the
current corpus (codecs.zig, no functions), both sides produce zero
entries. When zirFunc is ported and functions appear, per-function
textual Air comparison will be added.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:39:40 +00:00
218da7ec7c sema: capture per-function Air text via verbose_air_output
Enable verbose_air in the Zig Compilation and use a Writer.Allocating
to capture per-function Air text for later comparison with C sema output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 12:27:50 +00:00