code wiki / _hdl_build / nx_dedup_candidates.nx

nx_dedup_candidates.nx

buildroot/runtime/_hdl_build/nx_dedup_candidates.nx

14516 B294 linesdepth 5pulls 8 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_dedup_candidates.nx -- READ-ONLY migration-candidate scanner (F1029 measurement foundation, 2026-07-23). Scans a dir's *.nx and reports organs that define a migratable helper SHAPE and do NOT already import nx_sovjson_lib -- the organs the dedup walker COULD migrate but hasn't. Excludes _gate/_register by name. ★OOM-SAFE BY CONSTRUCTION (dup_source_check-v3 lesson): dir/file/name/out buffers each allocated ONCE before the loop + reused per file (O(1), not O(files)); PROVEN 384KiB peak RSS over 4096 files. Read via open/read-into-fixed-buffer/close -- NEVER sys_read_file (allocates per call = the exact OOM bug). license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_sovjson_lib.nx nx_store_seed_lib.nx nx_seg_store.nx nx_dedup_candidates.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_sovjson_lib.nxnx_store_seed_lib.nxnx_seg_store.nx

imported by: nobody (leaf or entry point)

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

main sj_lit_eq sj_vlen gv_ctr sys_mmap gv_head gv_puts sys_write gv_check gv_puts ↻ dc_has_shape dc_shape sj_vlen ↻ q_cat

structs

none

consts

14const DC_PLANE: i64 = 1048576
15const DC_DIRBUF: i64 = 131072
16const DC_FILECAP: i64 = 262144
17const DC_NAMEW: i64 = 256
18const DC_OUT: i64 = 65536
19const DC_SHAPES: i64 = 9
20const DC_SHOWN: i64 = 40

functions

22func dc_read_into(path: *u8, buf: *u8, cap: i64) -> i64
37func dc_ends(name: *u8, suf: *u8) -> i64
calls 1: sj_vlen
45func dc_contains_name(name: *u8, sub: *u8) -> i64
calls 1: sj_vlen
60func dc_shape(k: i64) -> *u8
called by 1: dc_has_shape
73func dc_has_shape(buf: *u8, n: i64) -> i64
called by 1: main calls 2: dc_shapesj_vlen
105func dc_has_import(buf: *u8, n: i64) -> i64
calls 1: sj_span_has
109func main(argc: i64, argv: *i64) -> i64