code wiki / _hdl_build / nx_gatelib_walkparity_gate.nx
nx_gatelib_walkparity_gate.nx
buildroot/runtime/_hdl_build/nx_gatelib_walkparity_gate.nx
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
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
structs
| none |
consts
| 42 | const WD_MAXNODE: i64 = 24000 |
| 43 | const WD_MAXEDGE: i64 = 300000 |
| 44 | const WD_ARENA: i64 = 4194304 |
| 45 | const WD_HASH: i64 = 65536 |
| 46 | const WD_FILECAP: i64 = 262144 |
functions
| 48 | func ww(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 49 | func 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 } |
| 55 | func bslen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: wd_walk |
| 59 | func wd_join(path: *u8, base_n: i64, nm: *u8) -> i64 called by 1: wd_walk |
| 66 | func wd_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 78 | func wd_isdotdot(nm: *u8) -> i64 called by 1: wd_walk |
| 82 | func wd_is_nx(nm: *u8, n: i64) -> i64 called by 1: wd_walk |
| 92 | func wd_walk(g: *EcoGraph, path: *u8, path_n: i64, filebuf: *u8, aoff: *i64, alen: *i64, st: *i64) -> i64 called by 2: wd_walkmain calls 16: sys_openat_rdsys_mmapsys_getdents64dirent_typedirent_namewd_isdotdot+10 |
| 141 | func main(argc: i64, argv: *i64) -> i64 |