code wiki / _hdl_build / nx_collision_plan.nx

nx_collision_plan.nx

buildroot/runtime/_hdl_build/nx_collision_plan.nx

6638 B114 linesdepth 3pulls 3 transitivereach 3 importersview sourcekind librarytopic collision
docsdependenciesstructsconstsfunctions

about

nx_collision_plan.nx -- the RESOLUTION PROPOSER: mechanizes the careful merge method for each shadow collision so the team can resolve sprawl without hand-judging every pair (and without ever losing a capability). For a shadowed basename it reads BOTH copies (runtime/<n> = A, runtime/_hdl_build/<n> = B), extracts each copy's FUNCTION-NAME SET, and from the set relationship proposes the resolution: shared==0 -> CODE 0 RENAME_DISTINCT : disjoint = two DIFFERENT capabilities sharing a name -> rename both to clear names (GROWTH, like nx_extract vs nx_func_extract). shared>0, onlyA==0, onlyB==0 -> CODE 1 KEEP_NEWER_GEN : same func-set, different bytes = the SAME capability in two GENERATIONS -> keep the _hdl_build (probe-first) canon, retire the old runtime gen. shared>0, onlyA==0, onlyB>0 -> CODE 2 RETIRE_A_SUBSET : B is the SUPERSET and B already RUNS (probe-first) = correct -> retire the runtime subset A. shared>0, onlyA>0, onlyB==0 -> CODE 3 CAPABILITY-LOSS!: A (runtime) is the SUPERSET but the LESS-capable B shadows it -> we are SILENTLY LOSING A's extra funcs -> must merge A's extras into B (or promote A). The highest-value catch. shared>0, onlyA>0, onlyB>0 -> CODE 4 MERGE_UNION : each copy has unique funcs -> merge the union into one. Toolchain-critical organs (nx_link = the ELF linker, never-brick #26) are flagged REVIEW regardless -- the proposer NEVER auto-executes; it emits a plan the warden/operator gates. READ-ONLY (never-brick by construction). RESIDUAL CAVEAT (honest): the program-vs-library signal is "has a top-level main". A LIBRARY that also carries a self-test main (e.g. nx_research_ledger, prints GREEN x2) looks like a program, so a library-vs-report pair can still slip through as MERGE_UNION. Full disambiguation needs IMPORT-ANALYSIS (does anything import it and call its exported funcs?) -- the next rung; for now the benchmark/human layer catches that edge. license_tier: ORIGINAL

dependencies 2 imports · 3 importers

nx_janitor_dupname.nx nx_syscalls.nx nx_collision_plan.nx nx_collision_harm.nx nx_collision_plan_gate.nx nx_collision_retire_safe.nx

imports: nx_janitor_dupname.nxnx_syscalls.nx

imported by: nx_collision_harm.nxnx_collision_plan_gate.nxnx_collision_retire_safe.nx

structs

none

consts

21const K_MAGIC_1024: i64 = 1024
22const K_MAGIC_1048576: i64 = 1048576
23const K_MAGIC_4000: i64 = 4000

functions

26func crp_is_ident(ch: u8) -> i64
called by 1: crp_extract_funcs
36func crp_extract_funcs(buf: *u8, len: i64, names: *u8, noff: *i64, maxn: i64) -> i64
called by 3: maincrp_plan_onemain calls 1: crp_is_ident
58func crp_name_in(name: *u8, names: *u8, noff: *i64, count: i64) -> i64
64func crp_setcmp(na: *u8, oa: *i64, ca: i64, nb: *u8, ob: *i64, cb: i64, out: *i64) -> i64
called by 1: crp_plan_one calls 1: crp_name_in
72func crp_is_toolchain(name: *u8) -> i64
called by 2: mainmain calls 1: jdn_streq
80func crp_classify(shared: i64, onlyA: i64, onlyB: i64) -> i64
called by 2: crp_classify2main
92func crp_classify2(shared: i64, onlyA: i64, onlyB: i64, hasMainA: i64, hasMainB: i64) -> i64
called by 2: crp_plan_onemain calls 1: crp_classify
99func crp_plan_one(name: *u8, ba: *u8, bb: *u8, na: *u8, oa: *i64, nb: *u8, ob: *i64, out: *i64) -> i64