code wiki / _hdl_build / nx_wasm_emit_seed.nx

nx_wasm_emit_seed.nx

buildroot/runtime/_hdl_build/nx_wasm_emit_seed.nx

3802 B85 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind tooltopic wasm
docsdependenciesstructsconstsfunctions

about

nx_wasm_emit_seed.nx -- SEED of the sovereign WAT->WASM emitter (G-WASM-001 milestone 1). Emits a real WebAssembly BINARY module BYTE-BY-BYTE from the encoding rules (NOT a memcpy of known output) for: (module (func (export "main") (result i64) i64.const 42)). Reuses runtime/leb128.nx (the verified LEB128 organ) for all sizes/counts/operands. Proves the sovereign encoding is byte-correct vs WABT used ONCE as an alignment oracle (then WABT leaves the path) -- the same pattern as qemu aligning the rv64 emu. NO node, NO python, NO WABT in this organ. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

leb128.nx nx_syscalls.nx nx_wasm_emit_seed.nx

imports: leb128.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap w8 emit_section w8 ↻ uleb128_encode wcopy sleb128_encode uleb128_encode ↻ wcopy ↻ sys_openat_wr sys_exit sys_write sys_close

structs

none

consts

10const K_MAGIC_1024: i64 = 1024

functions

12func w8(b: *u8, p: i64, v: i64) -> i64 { b[p] = v as u8; return p + 1 }
called by 2: emit_sectionmain
13func wcopy(dst: *u8, dp: i64, src: *u8, n: i64) -> i64
called by 2: emit_sectionmain
20func emit_section(out: *u8, p: i64, id: i64, sc: *u8, sclen: i64) -> i64
called by 1: main calls 3: w8uleb128_encodewcopy
27func main() -> i64