code wiki / _hdl_build / _xperf003c1_gate.nx

_xperf003c1_gate.nx

buildroot/runtime/_hdl_build/_xperf003c1_gate.nx

9065 B207 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx _xperf003c1_gate.nx

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

main g_puts sys_write sys_mmap sys_openat_wr sys_exit g_run sys_fork sys_dup3 sys_execve sys_exit ↻ sys_mmap ↻ sys_wait4 sys_close g_putn sys_mmap ↻ sys_write ↻ g_slurp sys_openat_rd sys_read sys_close ↻ g_parse_after g_match_at g_match_at ↻ sys_openat_append g_fputs sys_write ↻ g_fputn sys_mmap ↻ sys_write ↻

structs

none

consts

20const G_MODE_RWX: i64 = 0x1a4 // 0644
21const G_BUFSZ: i64 = 8192

functions

23func 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 }
called by 1: main calls 1: sys_write
24func 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 }
called by 1: main calls 1: sys_write
25func 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 }
called by 1: main calls 2: sys_mmapsys_write
26func 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 }
called by 1: main calls 2: sys_mmapsys_write
28func g_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64) -> i64
42func g_slurp(path: *u8, buf: *u8) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
56func g_match_at(buf: *u8, i: i64, key: *u8) -> i64
called by 2: g_parse_aftermain
65func g_parse_after(buf: *u8, blen: i64, key: *u8, notfound: i64) -> i64
called by 1: main calls 1: g_match_at
97func main() -> i64