code wiki / _hdl_build / nx_wasm_vm_verify.nx
nx_wasm_vm_verify.nx
buildroot/runtime/_hdl_build/nx_wasm_vm_verify.nx
about
nx_wasm_vm_verify.nx -- RUN ANY SHIPPED WASM MODULE IN THE MEMORY IT DECLARES.
WHY THIS IS GENERIC AND NOT A SEVENTEENTH COPY. On 2026-08-14 /craft shipped black TWICE. Every
stage of its emit pipeline was GREEN and its NATIVE gate reported 59/59, because a native gate
sys_mmaps its own arena and therefore never meets the wasm memory bound at all. The browser did,
and trapped on the first frame with "index out of bounds".
Measured the same day: the estate has ELEVEN *_wasm_vm_gate organs and NOT ONE of them is for a
game. They cover the sims and some crypto/codec modules. Every browser-playable wasm game ships a
module that byte-checks pass and nobody ever executes -- the identical blind spot, ~17 times over.
★SO THE RULER IS PARAMETERISED, NOT DUPLICATED. One organ, a path argument, no per-module
constants anywhere in it. The declared memory is NOT mirrored from the module's source either --
wm_parse already reads the wasm memory section and sizes mod.mem from it, so this asks the
ARTIFACT what it declares rather than trusting a number typed in a second file. A mirrored page
count is exactly the kind of constant that goes stale in one place and takes a page down.
WHAT IT PROVES, and only this:
PARSES -- the image is a real module
DECLARES -- it names a linear memory, and the VM allocates exactly that much
RUNS -- the exported entry points execute without leaving that memory (the VM bounds-checks)
PAINTS -- for a FRAMEBUFFER module (ww/hh/fb_off exported) the frame carries >1 colour
A module with no framebuffer surface is not a renderer, and this says NOT-A-RENDERER and abstains
rather than inventing a verdict about a subject it cannot see.
usage: nx_wasm_vm_verify <path.wasm> [noinit]
noinit -- skip init(), for modules whose world generation cannot finish in an interpreter.
nx_wasm_craft is the measured case: 786,432 voxels of noise, >120s. Its own gate
(nx_wasm_craft_vm_gate) seeds a minimal scene instead; this flag is the generic
escape so a slow init cannot be mistaken for a broken module.
exit: 0 GREEN | 1 RED | 3 the file could not be read
license_tier: ORIGINAL
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_wasm_vm.nxnx_gate_verdict.nxnx_base64.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 37 | const WV_COLCAP: i64 = 4096 |
| 52 | const WV_WASM_B64_MAGIC: *u8 = "AGFzbQEAAAA" |
| 53 | const WV_APOS: i64 = 39 |
| 54 | const WV_QUOTE: i64 = 34 |
| 60 | const WV_FRAME_BUDGET: i64 = 262144 |
functions
| 69 | func wv_w(s: *u8) -> i64 { return gv_puts(s) } |
| 70 | func wv_n(v: i64) -> i64 { return gv_num(v) } |
| 71 | func wv_rd64(m: *u8, o: i64) -> i64 { var v: i64=0; var i: i64=0; while i<8 { v = v | ((m[o+i] as i64) << (i*8)); i=i+1 } return v } |
| 72 | func wv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 73 | func wv_eq(a: *u8, b: *u8) -> i64 |
| 84 | func wv_find(buf: *u8, len: i64, needle: *u8) -> i64 |
| 98 | func main(argc: i64, argv: *i64) -> i64 |