Parent: #486 Depends on: #483, #465, #461 Blocks: #488, #489, #490
Goal
Implement an owned native baseline WebAssembly compiler with exact typed-stack, trap, GC, exception, memory, and JS-host semantics.
Scope
- Lower validated Wasm functions to a typed backend-neutral IR and native machine code through #483.
- Support all operations required by the declared profiles: numeric, control, calls/indirect/ref calls, tail calls, locals/globals/tables, bulk and multi-memory, memory64, references/GC, exceptions, SIMD stubs pending #488, and threads pending #490.
- Implement direct intra-module calls, guarded indirect calls, import/export trampolines, JS↔Wasm conversions, stack switching/reentrancy, and exact host exception/trap boundaries.
- Emit bounds/alignment/overflow checks, trap sites, precise Wasm/GC stack maps, source offsets, debugger/profiler metadata, and unwind/recovery state.
- Tier lazily or eagerly according to measured module size/use; cache code only with exact module/features/backend/options identity and bounded lifetime.
- Keep the portable interpreter as the forced-off differential oracle.
No-workaround rules
- No C compiler/LLVM/external assembler, system Wasm runtime, unchecked memory access, signal-only trap without recovery proof, unsupported opcode silently interpreted inside an advertised native artifact, or export-name specialization.
Acceptance
- Native-off/on differentials cover every opcode/profile family, traps, NaNs, exceptions, GC/reference movement, memory growth, imports/reentrancy, OOM, termination, and debugger metadata.
- Every declared backend publishes native artifacts and reports per-function compile/reject/execute counters.
- The full ten-profile corpus, focused sanitizer/fault tests, JS API, streaming compiler, no-GIL, TSan, and leak gates remain green.
- #461 records compile/instantiate latency, code bytes, native attribution, traps, bounds checks, runtime calls, and RSS.
- Representative scalar/call/memory rows materially outperform the interpreter with no semantic or memory regression.
Foundation
Decoder/validator/executor: src/wasm/decode.zig, validate.zig, exec.zig; exact corpus inventory in docs/.data/wasm-conformance-matrix.json.