nx_lang_h2h.nx
buildroot/runtime/nx_lang_h2h.nx
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
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
structs
| none |
consts
| 24 | const H2_PATH: i64 = 1024 |
| 25 | const H2_CAP_OUT: i64 = 1048576 // one captured child stdout: a whole emitted .s measured 135 KB, this holds 7x and ANNOUNCES a brim |
| 26 | const H2_CAP_PROC: i64 = 262144 // /proc/cpuinfo on a 16-way host measured about 20 KB; a brim is announced, never silent |
| 27 | const H2_CAP_RECEIPT: i64 = 65536 |
| 28 | const H2_ARGV_SLOTS: i64 = 16 |
| 29 | const H2_ENV_SLOTS: i64 = 8 |
| 30 | const H2_WORD: i64 = 8 |
| 31 | const H2_HEX: i64 = 72 |
| 32 | const H2_VER: i64 = 512 |
| 33 | const H2_NOTE: i64 = 512 |
| 34 | const H2_RUNS_MIN: i64 = 3 |
| 35 | const H2_RUNS_MAX: i64 = 64 |
| 36 | const H2_ARMS_FIXED: i64 = 5 |
| 37 | const H2_ARM_NX: i64 = 4 |
| 38 | const H2_MODE_MAX: i64 = 12 |
| 39 | const H2_FLAG_MAX: i64 = 16 |
| 40 | const H2_MODE_KEY: *u8 = "nxmode_" |
| 41 | const H2_MODE_KEY_LEN: i64 = 7 |
| 42 | const H2_MODE_RWX: i64 = 493 |
| 43 | const H2_MODE_RW: i64 = 420 |
| 44 | const H2_EXIT_VALID: i64 = 0 |
| 45 | const H2_EXIT_VOID: i64 = 1 |
| 46 | const H2_EXIT_USAGE: i64 = 2 |
| 47 | const H2_EXIT_UNMEASURABLE: i64 = 3 |
| 48 | const H2_SHA_BYTES: i64 = 32 |
| 49 | const H2_CHILD_FD_MAX: i64 = 256 |
| 50 | const H2_EINTR: i64 = 0 - 4 |
| 51 | const H2_EINTR_MAX: i64 = 4096 |
| 52 | const H2_ERR_PIPE: i64 = 0 - 2 |
| 53 | const H2_ERR_FORK: i64 = 0 - 3 |
| 54 | const H2_ERR_WAIT: i64 = 0 - 4 |
| 55 | const H2_ERR_WRITE: i64 = 0 - 7 |
| 56 | const H2_ERR_BRIM: i64 = 0 - 8 |
| 57 | const H2_ERR_EMPTY: i64 = 0 - 9 |
| 58 | const H2_EXEC_FAIL: i64 = 127 |
| 59 | const H2_NL: i64 = 10 |
| 60 | const H2_SP: i64 = 32 |
| 61 | const H2_ZERO: i64 = 48 |
| 62 | const H2_NINE: i64 = 57 |
| 63 | const H2_MINUS: i64 = 45 |
| 64 | const H2_COLON: i64 = 58 |
| 65 | const H2_SLASH: i64 = 47 |
| 66 | const H2_PIPE: i64 = 124 |
| 67 | const H2_KEY_ELAPSED: *u8 = "elapsed_us=" |
| 68 | const H2_KEY_CHECKSUM: *u8 = "checksum=" |
| 69 | const H2_DEVNULL: *u8 = "/dev/null" |
| 70 | const H2_ENV_PATH: *u8 = "PATH=/usr/bin:/bin:/usr/local/bin" |
| 71 | const H2_ENV_GOTOOLCHAIN: *u8 = "GOTOOLCHAIN=local" |
| 72 | const H2_PROC_CPUINFO: *u8 = "/proc/cpuinfo" |
| 73 | const H2_PROC_HOSTNAME: *u8 = "/proc/sys/kernel/hostname" |
| 74 | const H2_PROC_OSRELEASE: *u8 = "/proc/sys/kernel/osrelease" |
| 75 | const H2_WRITER: *u8 = "nx_lang_h2h" |
functions
| 77 | func h2_puts(s: *u8) -> i64 { sys_write(1, s, br_slen(s)); return 0 } |
| 78 | func 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 } |
| 80 | func h2_find(buf: *u8, n: i64, needle: *u8) -> i64 |
| 94 | func h2_num_at(buf: *u8, n: i64, at: i64, found: *i64) -> i64 called by 1: h2_num_after |
| 112 | func h2_num_after(buf: *u8, n: i64, key: *u8, found: *i64) -> i64 |
| 118 | func h2_first_line(src: *u8, n: i64, dst: *u8, cap: i64) -> i64 |
| 131 | func h2_hexdigit(v: i64) -> i64 { if v < 10 { return H2_ZERO + v } return 97 + (v - 10) } called by 1: h2_hex |
| 132 | func h2_hex(dst: *u8, off: i64, bytes: *u8, nb: i64) -> i64 |
| 146 | func h2_read_small(path: *u8, buf: *u8, cap: i64) -> i64 |
| 162 | func h2_file_sha(path: *u8, hexout: *u8) -> i64 |
| 174 | func h2_proc_value(buf: *u8, n: i64, key: *u8, dst: *u8, cap: i64) -> i64 |
| 205 | func h2_count_lines_starting(buf: *u8, n: i64, pfx: *u8) -> i64 |
| 224 | func h2_run(path: *u8, argv: *i64, envp: *i64, out: *u8, cap: i64, outlen: *i64) -> i64 called by 4: h2_buildh2_build_nx_modeh2_versionmain calls 11: sys_mmapsys_pipe2sys_forksys_closesys_dup3sys_openat_wr+5 |
| 267 | func h2_sort(a: *i64, n: i64) -> i64 called by 1: main |
| 282 | func h2_write_atomic(path: *u8, buf: *u8, n: i64) -> i64 called by 3: h2_buildh2_build_nx_modemain calls 6: sys_mmapbr_catsys_openat_wrsys_writesys_closesys_renameat |
| 295 | func h2_arm_name(i: i64) -> *u8 called by 1: main |
| 302 | func h2_arm_key(i: i64) -> *u8 called by 1: main |
| 309 | func h2_arm_tool(i: i64) -> *u8 called by 1: main |
| 316 | func h2_arm_srcfile(i: i64) -> *u8 called by 1: main |
| 323 | func h2_build(i: i64, tool: *u8, src: *u8, bin: *u8, nxasm: *u8, envp: *i64, out: *u8, cap: i64) -> i64 |
| 355 | func h2_build_nx_mode(tool: *u8, mode: *u8, src: *u8, bin: *u8, nxasm: *u8, envp: *i64, out: *u8, cap: i64) -> i64 |
| 376 | func h2_version(i: i64, tool: *u8, envp: *i64, out: *u8, cap: i64, dst: *u8, dcap: i64) -> i64 |
| 387 | func h2_refuse(key: *u8, conf: *u8) -> i64 |
| 393 | func h2_conf_str(cb: *u8, cn: i64, key: *u8, conf: *u8) -> *u8 |
| 399 | func main(argc: i64, argv: *i64) -> i64 |