code wiki / _hdl_build / _xperf003c1_gate.nx
_xperf003c1_gate.nx
buildroot/runtime/_hdl_build/_xperf003c1_gate.nx
about
_xperf003c1_gate.nx -- SOVEREIGN gate for rung X-PERF-003c1 (codegen redundant-defect
census; the honest BEFORE defect-count the codegen-win rung drives toward zero).
(1) Runs the SOVEREIGN-compiled census /tmp/nx_codegen_defect_census.sov.elf, which
itself re-invokes the REAL sovereign compiler on runtime/_hdl_build/nx_clbg_fannkuch.nx
to regenerate /tmp/fk.s and mechanically tallies the three redundant-codegen
defect classes over the fannkuch_redux hot region (NOT a fixture).
(2) Parses the census's CODEGENDEFECT line: total_redundant, store_reload, dead_spill,
const_remat, count (dominant), region_lines.
(3) ASSERTS total_redundant>0 AND dominant count>0 -> a real, addressable ROI target
exists (PASS condition). Census run rc must be 0 (it ran on real asm: compiled,
region found, non-empty).
(4) Appends the MEASURED line to knowledge/status/codegen_defect.log with the
CODEGENDEFECT anchor, then writes verdict=GREEN.
NO compiler change in this rung -> self-host and golden-diff are trivially preserved
(read-only analysis). spec: knowledge/specs/2026-06-13-codegen-defect-census.md
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 20 | const G_MODE_RWX: i64 = 0x1a4 // 0644 |
| 21 | const G_BUFSZ: i64 = 8192 |
functions
| 23 | func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 24 | func g_fputs(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 25 | func g_putn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 } |
| 26 | func g_fputn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(fd,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 } |
| 28 | func g_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64) -> i64 |
| 42 | func g_slurp(path: *u8, buf: *u8) -> i64 |
| 56 | func g_match_at(buf: *u8, i: i64, key: *u8) -> i64 |
| 65 | func g_parse_after(buf: *u8, blen: i64, key: *u8, notfound: i64) -> i64 |
| 97 | func main() -> i64 |