code wiki / _hdl_build / nx_bless_compiler.nx

nx_bless_compiler.nx

buildroot/runtime/_hdl_build/nx_bless_compiler.nx

14216 B297 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_bless_compiler.nx -- TEAM-OWNED self-deploy for the sovereign compiler (GAME arc G2, operator: "keep building the team to handle this autonomously"). The whole win-win-win update gate from [[project-pm-plan-maintainer-winwinwin-2026-06-05]] mechanized: 1. BUILD the candidate SOVEREIGNLY: current _offc compiler compiles runtime/nx_compile_x86.nx (retry-guarded), nxasm_x86_main assembles. nxasm crash/refusal -> REFUSE "BLOCKED-BY-G1" (today's state: the 2.4MB-.s capacity segfault). NO gcc anywhere on this path. 2. MEASURE: nx_game_gate runs twice -- candidate vs live _offc. Verdict is DATA (fails counts), not opinion. 3. BLESS only if candidate is STRICTLY better (fewer fails). The live compiler is backed up to _offc/nx_cc_sovereign.elf.bak first. 4. POST-VERIFY: gate the freshly blessed _offc; if it does not match the candidate's measurement, ROLL BACK from the .bak and re-verify. 5. The gate-loop daemon is STOPPED before measuring and RESTARTED after (two concurrent gates corrupt each other's /tmp artifacts -- learned live 2026-06-09). Exit: 0 blessed+verified, 1 refused (candidate not better), 2 blocked at build (G1), 3 rolled back (post-verify mismatch), 4 internal error. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_pm_review_log.nx nx_itoa_lib.nx nx_syscalls.nx nx_bless_compiler.nx

imports: nx_pm_review_log.nxnx_itoa_lib.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 sys_openat_wr bc_puts sys_write bc_run sys_fork sys_dup3 sys_execve sys_exit sys_mmap ↻ sys_wait4 sys_close bc_filesize sys_openat_rd sys_mmap ↻ sys_read sys_close ↻ bc_putn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap pm_open sys_openat_append pm_gap pm_flag pm_w sys_write ↻ pm_cstr_len bc_read_pidfile sys_mmap ↻ sys_read_file sys_openat_rd ↻ sys_lseek sys_mmap ↻ sys_read ↻ sys_close ↻

structs

none

consts

26const BC_MAGIC_65536: i64 = 65536
27const BC_MAGIC_4095: i64 = 4095
28const BC_MAGIC_4096: i64 = 4096
30const BC_MIN_ASM_BYTES: i64 = 128
31const BC_MAX_RETRIES: i64 = 12

functions

33func bc_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
38func bc_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
39func bc_cat(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
40func bc_cat_n(dst: *u8, off: i64, v: i64) -> i64
calls 1: sys_mmap
53func bc_run(path: *u8, argv: *i64, envp: *i64, redir_out: i64, redir_err: i64) -> i64
68func bc_run1(path: *u8, arg1: *u8, envp: *i64, devnull: i64) -> i64
called by 1: main calls 2: sys_mmapbc_run
74func bc_filesize(path: *u8) -> i64
86func bc_copy(src: *u8, dst: *u8) -> i64
102func bc_read_pidfile(path: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
120func bc_substr(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: bc_equiv_green
137func bc_equiv_green() -> i64
160func main(argc: i64, argv: *i64) -> i64