From 8caf6ba25981ea6470ca78b45f113c2d1ee45b59 Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Fri, 11 Sep 2026 02:29:04 -0600 Subject: [PATCH] =?UTF-8?q?phase-36:=20alloc=5Ftable=20prints=20gcc's=20tr?= =?UTF-8?q?uncated=20integer=20priority=20and=20flags=20ties=20(global.c:5?= =?UTF-8?q?94-607)=20=E2=80=94=20e14's=20integer-tie=20closes=20were=20inv?= =?UTF-8?q?isible=20in=20the=20float=20column;=20e14=20banked=204=20(ov=5F?= =?UTF-8?q?SC06=5F010)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/SETUP.md | 1 + tools/alloc_table.py | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/SETUP.md b/docs/SETUP.md index 08efe622e1..902f2794c6 100644 --- a/docs/SETUP.md +++ b/docs/SETUP.md @@ -1820,6 +1820,7 @@ CLAIM, not a fact — two were refuted on bytes on 2026-09-10.** classes the pass has judged and not closed. An ALL-families pass (`--families R2 … R26`, `-j 26`) costs ~1.8 s per `--try` and 100–370 candidates per head class; it closed an R12 class in its first minute, so re-running the old families on a moved tree is not redundant. +- **`tools/alloc_table.py` prints the INTEGER priority (S104)** — `global.c:594-603` stores it in a `register int` (truncated) and breaks ties by allocno number (`:607`); equal integers are flagged `TIE`. The float column hid e12/e14's closes (245.6 vs 245.2). Known-true: e14's `func_8017BEBC` lever-free dumps show the two `&g.sz` pseudos at 245 TIE. - **`delever_pack.related_bodies` for main (S104):** main's units are `src/800*.c`, not `src/main/` — the search now falls back to the target TU's directory; every main pack's `related.txt` had been empty (e3: the answers were same-TU siblings sharing a global). Known-true: `func_80036FB0`'s pack now lists 7 bodies sharing `D_8006AEE8`/`D_80078F10`. - **Marked ordinary-C fakes (S104, Drew's ruling (a)):** a `// !FAKE:` on a `do { … } while (0)` line or a `!FAKE: do-while|dead-init` marker is a KEPT fake (sotn-decomp's STYLE.md rule), not an orphan and not a lever — diff --git a/tools/alloc_table.py b/tools/alloc_table.py index a92592e68d..ad095e9a48 100644 --- a/tools/alloc_table.py +++ b/tools/alloc_table.py @@ -77,12 +77,15 @@ def main(): order = [int(x) for x in mo.group(2).split()] rows = [] for n, r in regs.items(): - pri = (math.floor(math.log2(r["refs"])) * r["refs"] / r["live"]) * 10000 if r["refs"] > 0 and r["live"] > 0 else 0 + # global.c:594-603 stores the priority in a `register int` — TRUNCATED — and breaks a tie by allocno number (:607). + # S104 e12/e14: two closes hinged on ties the old float column hid (245.6 vs 245.2 are both 245). + pri = int((math.floor(math.log2(r["refs"])) * r["refs"] / r["live"]) * 10000) if r["refs"] > 0 and r["live"] > 0 else 0 rows.append((pri, n, r)) rows.sort(key=lambda x: (-x[0], x[1])) print(f"alloc_table {fn} ({tag}): {len(regs)} pseudo(s) in the .lreg table" + (f"; .greg order: {' '.join(str(x) for x in order)}" if order else "; .greg printed no order line")) print(f" {'pseudo':>7} {'hard':>5} {'pri':>10} {'refs':>5} {'live':>5} {'blk':>5} prefs / notes") + tied = {p_ for p_, c in __import__("collections").Counter(p_ for p_, _n, _r in rows).items() if c > 1 and p_ > 0} for pri, n, r in rows: h = hard.get(n) hn = NAMES.get(h, str(h)) if h is not None else "-" @@ -93,7 +96,9 @@ def main(): hardconf = [NAMES[x] for x in conf[n] if x in NAMES] # the HARD regs it may not take if hardconf: note = f"conflicts {','.join(hardconf)} " + note - print(f" r{n:<6} {hn:>5} {pri:10.1f} {r['refs']:5d} {r['live']:5d} {str(r['block']):>5} {note}") + if pri in tied: + note = "TIE (lower allocno wins, global.c:607) " + note + print(f" r{n:<6} {hn:>5} {pri:10d} {r['refs']:5d} {r['live']:5d} {str(r['block']):>5} {note}") # R32: the order line over-approximates the allocnos; anything it names that this table lacks is a SILENT GAP missing = [x for x in order if x not in regs] if missing: