Skip to content

Specializer M-interp: closure-compiled IR interpreter (the oracle backend) - #25

Merged
ahrzb merged 3 commits into
claude/duckdb-native-interpreter-36d016from
claude/specializer-m-interp
Jul 25, 2026
Merged

Specializer M-interp: closure-compiled IR interpreter (the oracle backend)#25
ahrzb merged 3 commits into
claude/duckdb-native-interpreter-36d016from
claude/specializer-m-interp

Conversation

@claude-agent-ahrzb

Copy link
Copy Markdown

What (TASK-42, milestone m-7 — stacked on #23, follows merged #24)

The interpreter backend over the M-ir IR, per design doc §7:

  • exec/mod.rs — runtime substrate: columnar Batch, byte-backed bump Arena (StrRef spans; extend_from_within makes sconcat allocation-free), map statics as sorted vecs probed by allocation-free binary search (perfect hashing stays the codegen backend's game), reusable RunState.
  • exec/interp.rscompile() verifies first (unverified IR is uncompilable), then one pre-traversal builds per-block closure vectors; terminators are a small enum in the row loop. Boundary checks trap (not panic) on input-shape and foreign-RunState mismatches.
  • Semantics pins (documented, provisional until the M-lower DuckDB differential): checked i64 arithmetic traps on overflow, idiv/irem trap on 0 and MIN/-1, IEEE floats, fcmp IEEE-ordered, ftoi.round half-away-from-zero, exact-parse stoi/stof.

Verification

  • All 5 M-ir fixtures execute against hand-computed expectations, including the CASTS trap path
  • Zero-allocation steady state asserted by a thread-local counting global allocator on a warmed run
  • 150-seed generated programs compile and execute deterministically (|out| <= |in|, byte-identical reruns)
  • mise gate-specializer green: cargo 55 passed, pytest 574 passed + 12 xfailed
  • Adversarial workflow findings land as follow-up commits on this branch

🤖 Generated with Claude Code

ahrzb and others added 3 commits July 25, 2026 20:52
…terp)

src/specializer/exec/: runtime substrate (Batch, byte-backed bump Arena with
StrRef spans, sorted-vec map statics probed by allocation-free binary
search) + interp.rs (compile verifies first — nothing executes unverified
IR — then one pre-traversal builds per-block closures; terminators are a
small enum in the row loop; branch-arg copies are safe by SSA disjointness).

Steady state allocates nothing: registers/arena/out builders live in a
reusable RunState; a thread-local counting global allocator asserts zero
allocs on a warmed run. Semantics pins documented in interp.rs (checked
integer arithmetic, IEEE floats, half-away-from-zero ftoi.round, exact-parse
stoi/stof) — provisional until the DuckDB differential at M-lower.

All five M-ir fixtures execute against hand-computed expectations incl. the
trap path; 150-seed generated programs execute deterministically. TASK-42.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
… — TASK-42

Six agents (4 attack lenses + 2 reviews) probed the oracle; confirmed
findings fixed and pinned:

- StrRef offsets widened u32 -> usize: a single call legitimately exceeding
  4 GiB of varlen data silently aliased old spans (Ok with corrupt output —
  the one thing an oracle must never do)
- store.opt with a false flag now stores the type-default payload the spec
  pins, not the live register
- check_input validates the validity lane of nullable columns (a short
  valid vec silently meant "all valid")
- register slots assigned densely at compile: sparse-but-legal value ids
  can no longer inflate the frame (Value(u32::MAX) demanded a 64 GiB vec)
- zero-allocation claim restated honestly: warmth is per content profile
  (branch paths, probe hits, non-NULL varlen), growth one-time + monotone —
  refuted-as-written by branch/probe/validity flips at identical shape
- RunState.emitted reports the row count (observable with 0 out columns)
- Ctx made private; out_decl drops its unread nullable flag; probe hit arm
  zips entry values directly
- semantics pins now all tested: overflow/div traps incl. irem MIN%-1, fcmp
  NaN table, ftoi ties + range traps, IEEE inf/nan flow, scmp order, exact
  stoi parse, load.opt garbage normalization

cargo 65 passed; gate green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…notes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ahrzb
ahrzb merged commit 590b820 into claude/duckdb-native-interpreter-36d016 Jul 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant