issues: file 0143 (pack-as-[]Type stride mismatch) + record out is end-state-only

0143: a ..$args pack forwarded as a []Type argument across a call is backed by a
[N x Any] (16B) array but viewed as []type_value (8B) -> half-stride reads. A
lowering bug the legacy Value model masks; the byte-accurate VM exposes it. Blocks
examples/0114 on the VM. Filed per CLAUDE.md (not worked around; the type_name
.unresolved guard only makes the VM decline rather than emit garbage).

Checkpoint also records the sequencing insight: comptime `out` (print) can only
land once the fallback is removed (a print-then-bail double-prints under the legacy
re-run), so side-effecting ops + fallback-removal are the FINAL step; pure ops +
migrations land first.
This commit is contained in:
agra
2026-06-18 19:28:04 +03:00
parent 379ed05495
commit a446550013
2 changed files with 105 additions and 0 deletions

View File

@@ -373,6 +373,25 @@ when reached (sentinels or accessor fns; see the design doc Risks).
`List` growth; orthogonal, see `current/CHECKPOINT-METATYPE.md`.)
## Log
- **Phase 4 burndown — switch_br + type_name ported; issue 0143 filed; KEY sequencing insight: `out` is end-state-only (2026-06-18).**
Ported two PURE comptime ops (`379ed05`): `switch_br` (i64-discriminant multi-way branch — enum/error
tag or `.type_value` index) and `type_name` (Type value / Any box → `table.typeName`, with an
`.unresolved`-bail guard). Correct in isolation; 05200524 run GREEN under strict. **Two blockers found:**
1. **issue 0143 (FILED, OPEN) — pack-as-`[]Type` stride mismatch.** A `..$args` pack forwarded as a
`[]Type` ARGUMENT across a call is backed by a `[N x Any]` (16B) array but viewed as `[]type_value`
(8B) → half-stride reads (`[i64 <unresolved> string]` vs legacy `[i64 string bool]`). A LOWERING bug
the legacy's Value model masks; the byte-accurate VM exposes it. Blocks `examples/0114` from running
HANDLED. **Per CLAUDE.md: filed, NOT worked around** (the `type_name` `.unresolved` guard just makes
the VM decline rather than emit garbage). Repro + fix-prompt in `issues/0143-…md`.
2. **`out` (comptime print) is an END-STATE op — it cannot land while the fallback exists.** Under the
legacy fallback, an eval that prints via `out` then BAILS double-prints (the VM wrote to fd 1, then
legacy re-runs the whole eval — no rewind). 0114 demonstrated it. So a direct-write `out` is only
safe once the fallback is GONE (strict-by-default). **Revised ordering:** land the PURE ops
(switch_br/type_name/type_is_unsigned/error_tag_name_get/global_addr/interp_print_frames) + the
BuildOptions migration + #insert + bundler FIRST; then in the FINAL step flip strict-to-default
(removing the fallback) AND add `out` together — at which point every `out`-using example flips
atomically with deletion. (Most of the gap-list examples print, so they stay on fallback until that
final flip — that's expected, not a regression.) 699/0 both default gates.
- **Phase 4 — STRICT no-fallback mode (the interp-retirement enumeration gate) + full gap list (2026-06-18).**
Added `-Dcomptime-flat-strict` / env `SX_COMPTIME_FLAT_STRICT` (implies `comptime_flat`): at all
THREE comptime sites (type-fn in `lower/comptime.zig`, const-init + `#run` in `emit_llvm.zig`) a VM