code wiki / _hdl_build / nx_gatelib_walkparity_gate.nx

nx_gatelib_walkparity_gate.nx

buildroot/runtime/_hdl_build/nx_gatelib_walkparity_gate.nx

9433 B216 linesdepth 6pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_gatelib_walkparity_gate.nx -- PROOF THAT THE SHARED WALK IS THE SAME WALK. ★★★THE ANSWER: THEY ARE IDENTICAL, AND THREE DIAGNOSES SAID OTHERWISE. ===== WHY THIS EXISTS ============================================ Wave 29 extracted a shared tree walk (gl_walk) and wave 30 tried to adopt it in nx_eco_graph_build, which had its own copy. Run back to back on the same tree the two walks scanned an IDENTICAL number of files (6368) but produced 7077 vs 7080 nodes and 14498 vs 14502 edges. Three names and four edges, about 0.04%, reproducible and unexplained -- so the adoption was reverted rather than shipped. Counts established THAT they differ. Only the NAME SETS can say WHAT differs, and that is the entire point of this organ. ===== THE CONCURRENCY PROBLEM, SOLVED PROPERLY =================== Two earlier diagnoses were wrecked by the same thing: this tree is edited by other sessions while a scan runs, so a sequential before/after diffs the clock rather than the code. The obvious fix is to freeze a copy of the subtree, which for 6000+ files is slow and itself racy. ★THE CHEAPER AND STRICTER FIX: run BOTH walks inside ONE PROCESS, back to back, then REFUSE TO REPORT unless both saw the same file count. The window shrinks from minutes to microseconds, and the file-count equality is a checkable precondition rather than an assumption -- if the tree moved mid-run the organ says so instead of blaming the code. Named for nx_gatelib because the invariant it protects is gl_walk's: if anyone changes the shared walk, this fails and names the drifted files. [root-dir] default runtime/_hdl_build expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_eco_graph.nx nx_import_scan.nx nx_gatelib.nx nx_gatelib_walkparity_gate.nx

imports: nx_syscalls.nxnx_eco_graph.nxnx_import_scan.nxnx_gatelib.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 eg_new sys_mmap ↻ gl_walk sys_openat_rd sys_mmap ↻ sys_getdents64 dirent_type dirent_name gl_isdotdot gl_join gl_walk ↻ gl_len gl_is_nx eg_intern eg_hash eg_name_eq gl_read sys_openat_rd ↻ sys_read sys_close nis_scan nis_is_ws eg_add_edge dirent_reclen sys_close ↻ wd_walk sys_openat_rd ↻ sys_mmap ↻ sys_getdents64 ↻ dirent_type ↻ dirent_name ↻ wd_isdotdot wd_join wd_walk ↻ bslen wd_is_nx eg_intern ↻ wd_read

structs

none

consts

42const WD_MAXNODE: i64 = 24000
43const WD_MAXEDGE: i64 = 300000
44const WD_ARENA: i64 = 4194304
45const WD_HASH: i64 = 65536
46const WD_FILECAP: i64 = 262144

functions

48func ww(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
49func wn(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m } let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; 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 { b[i] = t[k - 1 - i]; i = i + 1 } sys_write(1, b, k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
55func bslen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: wd_walk
59func wd_join(path: *u8, base_n: i64, nm: *u8) -> i64
called by 1: wd_walk
66func wd_read(path: *u8, buf: *u8, cap: i64) -> i64
78func wd_isdotdot(nm: *u8) -> i64
called by 1: wd_walk
82func wd_is_nx(nm: *u8, n: i64) -> i64
called by 1: wd_walk
92func wd_walk(g: *EcoGraph, path: *u8, path_n: i64, filebuf: *u8, aoff: *i64, alen: *i64, st: *i64) -> i64
141func main(argc: i64, argv: *i64) -> i64