code wiki / _hdl_build / nx_dedup_candidates.nx
nx_dedup_candidates.nx
buildroot/runtime/_hdl_build/nx_dedup_candidates.nx
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
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
structs
| none |
consts
| 14 | const DC_PLANE: i64 = 1048576 |
| 15 | const DC_DIRBUF: i64 = 131072 |
| 16 | const DC_FILECAP: i64 = 262144 |
| 17 | const DC_NAMEW: i64 = 256 |
| 18 | const DC_OUT: i64 = 65536 |
| 19 | const DC_SHAPES: i64 = 9 |
| 20 | const DC_SHOWN: i64 = 40 |
functions
| 22 | func dc_read_into(path: *u8, buf: *u8, cap: i64) -> i64 |
| 37 | func dc_ends(name: *u8, suf: *u8) -> i64 calls 1: sj_vlen |
| 45 | func dc_contains_name(name: *u8, sub: *u8) -> i64 calls 1: sj_vlen |
| 60 | func dc_shape(k: i64) -> *u8 called by 1: dc_has_shape |
| 73 | func dc_has_shape(buf: *u8, n: i64) -> i64 |
| 105 | func dc_has_import(buf: *u8, n: i64) -> i64 calls 1: sj_span_has |
| 109 | func main(argc: i64, argv: *i64) -> i64 |