code wiki / _hdl_build / nx_wasmpage_census.nx
nx_wasmpage_census.nx
buildroot/runtime/_hdl_build/nx_wasmpage_census.nx
about
nx_wasmpage_census.nx -- EVERY SHIPPED PAGE THAT CARRIES A WASM MODULE, VERIFIED. NO SAMPLING.
WHY IT EXISTS. On 2026-08-14 /craft shipped black twice because its framebuffer had outgrown the
module's own declared linear memory, and nothing in the pipeline could see it: size floors and
magic bytes cannot tell a module that RUNS from one that TRAPS. The fit guard now lives in the
shared emitter, so no NEW page can ship with that defect -- but every page emitted BEFORE the
guard existed is still out there unmeasured, and I could not enumerate them: a grep across the
docroot's 79,966 files times out.
★"TOO SLOW TO MEASURE" IS A TOOLING GAP, NEVER A LICENCE TO SAMPLE. This is the tool.
WHAT IT DOES: walks the docroot, and for every .html that carries an embedded module (the emitter
writes it as const B="<base64>") forks nx_wasm_vm_verify on that page and classifies the verdict.
★IT COMPOSES THE RULER RATHER THAN RE-IMPLEMENTING IT. The decode, the parse, the declared-memory
read and the fit arithmetic all live in nx_wasm_vm_verify; duplicating any of that here would give
the estate two answers to one question and no way to tell which had rotted.
The partition is printed and RECONCILED against the file count -- a census whose parts do not sum
is a leak, and every OVERSIZE page is NAMED, because a count without a worklist is not actionable.
license_tier: ORIGINAL expect_exit: 0
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.nxnx_gate_verdict.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 24 | const WC_VERIFY: *u8 = "nx_wasm_vm_verify.elf" |
| 33 | const WC_ANCHOR: *u8 = "AGFzbQEAAAA" |
| 34 | const WC_DIRBUF: i64 = 131072 |
| 35 | const WC_PATHBUF: i64 = 4096 |
| 36 | const WC_OUTCAP: i64 = 262144 |
| 40 | const WC_MIN_PAGE: i64 = 4096 |
| 44 | const WC_TIMEOUT_MS: i64 = 10000 |
| 47 | const WC_MAXDEPTH: i64 = 12 |
| 52 | const WC_JSMARK: *u8 = "WebAssembly.instantiate" |
| 55 | const WC_ARGV_SLOTS: i64 = 5 |
| 97 | const WC_TAL_SLOTS: i64 = 16 |
functions
| 66 | func wc_puts(s: *u8) -> i64 { return gv_puts(s) } |
| 67 | func wc_num(v: i64) -> i64 { return gv_num(v) } |
| 68 | func wc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 69 | func wc_is_html(nm: *u8) -> i64 |
| 79 | func wc_find(buf: *u8, len: i64, needle: *u8) -> i64 |
| 99 | func wc_tal() -> *i64 { if WC_TAL == 0 { WC_TAL = sys_mmap(WC_TAL_SLOTS * 8) as i64 } return WC_TAL as *i64 } |
| 107 | func wc_lenbox() -> *i64 { if WC_LENBOX == 0 { WC_LENBOX = sys_mmap(16) as i64 } return WC_LENBOX as *i64 } |
| 109 | func wc_argvbox() -> *i64 { if WC_ARGVBOX == 0 { WC_ARGVBOX = sys_mmap(WC_ARGV_SLOTS * 8) as i64 } return WC_ARGVBOX as *i64 } |
| 111 | func wc_outbox() -> *u8 { if WC_OUTBOX == 0 { WC_OUTBOX = sys_mmap(WC_OUTCAP) as i64 } return WC_OUTBOX as *u8 } |
| 113 | func wc_olenbox() -> *i64 { if WC_OLENBOX == 0 { WC_OLENBOX = sys_mmap(16) as i64 } return WC_OLENBOX as *i64 } |
| 115 | func wc_check(path: *u8) -> i64 |
| 208 | func wc_walk(dir: *u8, depth: i64) -> i64 |
| 259 | func main(argc: i64, argv: *i64) -> i64 |