code wiki / (root) / nx_lang_h2h.nx

nx_lang_h2h.nx

buildroot/runtime/nx_lang_h2h.nx

32169 B659 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind tooltopic lang
docsdependenciesstructsconstsfunctions

about

nx_lang_h2h.nx -- THE HEAD-TO-HEAD COMPILER BENCHMARK, SOVEREIGN AND RECEIPTED (2026-09-01). Operator: "nishi lang to get to sota and best of breed and to meet and exceed gcc and rust ... independently verified with evidence documented and our /compare properly storing and making the evidence reproducible". This retires bench/nx_lang_h2h.sh -- shell that built, timed, parsed and judged, the forbidden shape. It builds every arm from source, runs each arm N times, requires every arm to print the SAME checksum, and writes ONE receipt (<out>, the <dom>.bench data class) carrying: host, CPU and kernel; every toolchain's version; every source and binary sha256; min and median microseconds; the checksum; the exact repro command; and a verdict derived by nx_bench_receipt_lib -- the SAME classifier the /compare page and the gate run. Nothing is judged here: an arm whose toolchain is absent is UNMEASURABLE (declared), never dropped; an arm whose checksum differs is VOID (its time is never ranked); a build or run failure names its exit code. The child runner is deliberately NOT tr_run_capture: that primitive merges stderr into the capture (a compiler warning would land inside an emitted .s) and fixes envp to PATH alone (the rustup shim needs HOME, go needs a writable GOCACHE). Same fork/pipe/drain shape, stdout only, envp from the conf -- a different contract, named. usage: nx_lang_h2h <conf> conf keys (line-anchored, nx_lineconf_lib, a missing required key REFUSES): dom= title= workload= home= runs= workdir= srcdir= ref= out= nxcc= nxasm= nxsrc= [gcc=] [clang=] [rustc=] [go=] exit: 0 VALID . 1 VOID (an arm disagrees on the checksum) . 2 usage or conf refusal . 3 UNMEASURABLE (the reference arm or the NishiLang arm could not be measured -- no ratio exists) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_lineconf_lib.nx nx_sha256.nx nx_bench_receipt_lib.nx nx_lang_h2h.nx

imports: nx_syscalls.nxnx_lineconf_lib.nxnx_sha256.nxnx_bench_receipt_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main h2_puts sys_write br_slen sys_exit sys_mmap nxa_die sys_write ↻ sys_exit ↻ nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close h2_conf_str sys_mmap ↻ lcf_str lcf_find h2_refuse h2_puts ↻ sys_exit ↻ lcf_int lcf_find ↻ h2_refuse ↻ sys_mkdir br_cat h2_read_small

structs

none

consts

24const H2_PATH: i64 = 1024
25const H2_CAP_OUT: i64 = 1048576 // one captured child stdout: a whole emitted .s measured 135 KB, this holds 7x and ANNOUNCES a brim
26const H2_CAP_PROC: i64 = 262144 // /proc/cpuinfo on a 16-way host measured about 20 KB; a brim is announced, never silent
27const H2_CAP_RECEIPT: i64 = 65536
28const H2_ARGV_SLOTS: i64 = 16
29const H2_ENV_SLOTS: i64 = 8
30const H2_WORD: i64 = 8
31const H2_HEX: i64 = 72
32const H2_VER: i64 = 512
33const H2_NOTE: i64 = 512
34const H2_RUNS_MIN: i64 = 3
35const H2_RUNS_MAX: i64 = 64
36const H2_ARMS_FIXED: i64 = 5
37const H2_ARM_NX: i64 = 4
38const H2_MODE_MAX: i64 = 12
39const H2_FLAG_MAX: i64 = 16
40const H2_MODE_KEY: *u8 = "nxmode_"
41const H2_MODE_KEY_LEN: i64 = 7
42const H2_MODE_RWX: i64 = 493
43const H2_MODE_RW: i64 = 420
44const H2_EXIT_VALID: i64 = 0
45const H2_EXIT_VOID: i64 = 1
46const H2_EXIT_USAGE: i64 = 2
47const H2_EXIT_UNMEASURABLE: i64 = 3
48const H2_SHA_BYTES: i64 = 32
49const H2_CHILD_FD_MAX: i64 = 256
50const H2_EINTR: i64 = 0 - 4
51const H2_EINTR_MAX: i64 = 4096
52const H2_ERR_PIPE: i64 = 0 - 2
53const H2_ERR_FORK: i64 = 0 - 3
54const H2_ERR_WAIT: i64 = 0 - 4
55const H2_ERR_WRITE: i64 = 0 - 7
56const H2_ERR_BRIM: i64 = 0 - 8
57const H2_ERR_EMPTY: i64 = 0 - 9
58const H2_EXEC_FAIL: i64 = 127
59const H2_NL: i64 = 10
60const H2_SP: i64 = 32
61const H2_ZERO: i64 = 48
62const H2_NINE: i64 = 57
63const H2_MINUS: i64 = 45
64const H2_COLON: i64 = 58
65const H2_SLASH: i64 = 47
66const H2_PIPE: i64 = 124
67const H2_KEY_ELAPSED: *u8 = "elapsed_us="
68const H2_KEY_CHECKSUM: *u8 = "checksum="
69const H2_DEVNULL: *u8 = "/dev/null"
70const H2_ENV_PATH: *u8 = "PATH=/usr/bin:/bin:/usr/local/bin"
71const H2_ENV_GOTOOLCHAIN: *u8 = "GOTOOLCHAIN=local"
72const H2_PROC_CPUINFO: *u8 = "/proc/cpuinfo"
73const H2_PROC_HOSTNAME: *u8 = "/proc/sys/kernel/hostname"
74const H2_PROC_OSRELEASE: *u8 = "/proc/sys/kernel/osrelease"
75const H2_WRITER: *u8 = "nx_lang_h2h"

functions

77func h2_puts(s: *u8) -> i64 { sys_write(1, s, br_slen(s)); return 0 }
called by 2: h2_refusemain calls 2: sys_writebr_slen
78func h2_putn(v: i64) -> i64 { let t: *u8 = sys_mmap(32); let n: i64 = br_catn(t, 0, v); sys_write(1, t, n); return 0 }
called by 1: main calls 3: sys_mmapbr_catnsys_write
80func h2_find(buf: *u8, n: i64, needle: *u8) -> i64
called by 1: h2_num_after calls 1: br_slen
94func h2_num_at(buf: *u8, n: i64, at: i64, found: *i64) -> i64
called by 1: h2_num_after
112func h2_num_after(buf: *u8, n: i64, key: *u8, found: *i64) -> i64
called by 1: main calls 3: h2_findh2_num_atbr_slen
118func h2_first_line(src: *u8, n: i64, dst: *u8, cap: i64) -> i64
called by 2: h2_versionmain
131func h2_hexdigit(v: i64) -> i64 { if v < 10 { return H2_ZERO + v } return 97 + (v - 10) }
called by 1: h2_hex
132func h2_hex(dst: *u8, off: i64, bytes: *u8, nb: i64) -> i64
called by 1: h2_file_sha calls 1: h2_hexdigit
146func h2_read_small(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
162func h2_file_sha(path: *u8, hexout: *u8) -> i64
174func h2_proc_value(buf: *u8, n: i64, key: *u8, dst: *u8, cap: i64) -> i64
called by 1: main calls 1: br_slen
205func h2_count_lines_starting(buf: *u8, n: i64, pfx: *u8) -> i64
called by 1: main calls 1: br_slen
224func h2_run(path: *u8, argv: *i64, envp: *i64, out: *u8, cap: i64, outlen: *i64) -> i64
267func h2_sort(a: *i64, n: i64) -> i64
called by 1: main
282func h2_write_atomic(path: *u8, buf: *u8, n: i64) -> i64
295func h2_arm_name(i: i64) -> *u8
called by 1: main
302func h2_arm_key(i: i64) -> *u8
called by 1: main
309func h2_arm_tool(i: i64) -> *u8
called by 1: main
316func h2_arm_srcfile(i: i64) -> *u8
called by 1: main
323func h2_build(i: i64, tool: *u8, src: *u8, bin: *u8, nxasm: *u8, envp: *i64, out: *u8, cap: i64) -> i64
355func h2_build_nx_mode(tool: *u8, mode: *u8, src: *u8, bin: *u8, nxasm: *u8, envp: *i64, out: *u8, cap: i64) -> i64
376func h2_version(i: i64, tool: *u8, envp: *i64, out: *u8, cap: i64, dst: *u8, dcap: i64) -> i64
387func h2_refuse(key: *u8, conf: *u8) -> i64
called by 2: h2_conf_strmain calls 2: h2_putssys_exit
393func h2_conf_str(cb: *u8, cn: i64, key: *u8, conf: *u8) -> *u8
called by 1: main calls 3: sys_mmaplcf_strh2_refuse
399func main(argc: i64, argv: *i64) -> i64