diff --git a/docs/matching-cookbook.md b/docs/matching-cookbook.md index 050ea470a..cea293352 100644 --- a/docs/matching-cookbook.md +++ b/docs/matching-cookbook.md @@ -2504,6 +2504,23 @@ crack (the type-using triage cracks AND the Fable5 cores) flows through to reach bodies, no reconcile) still template via plain `--hseq` (Task 5: 399 banked). Key: reconcile PER SIBLING from the RAW draft, never remap the ov077-reconciled body. +### §31-triage — R17 applies to CODEGEN residuals, never to a compile ERROR (Phase 26 session 7, Drew asked) + +Before reaching for `tools/reference/gcc-2.7.2/` or the `docs/gcc-2.7.2-map/`, classify the failure: + +| Symptom | Cause | Tool | +|---|---|---| +| The build SUCCEEDS but the bytes differ | a codegen decision (regalloc / sched / cross-jump / CSE / loop) | **R17** — read the pass, or gdb-on-cc1 (§45-B) | +| The build FAILS to compile (`conflicting types`, `undeclared`, `parse error`) | plain C89 semantics — gcc is CORRECT | **our tooling.** Reading gcc source tells you nothing | + +Byte-example: the `func_8015AE2C` ×133 sweep blocker is `conflicting types for D_801812A4` — two incompatible +file-scope decls of one identifier in one TU. That is not a gcc quirk; `reconcile_decls` was picking a +**fleet-majority** canonical type instead of the type the TU can actually SEE (its §8b carried decl layer). +A `loop.c`/`global.c` read would have been pure waste. Contrast `func_8017BEBC` (close=2, an `allocno`-priority +tie in `global.c`): compiles fine, wrong bytes → exactly an R17/§45-B target. + +**Rule of thumb: "wrong BYTES" → read the compiler. "won't COMPILE" → read our Python.** + ## §41 — The DEF-SIDE canonical-sig wall: mechanically banking a drafted giant past `conflicting types` (Phase 25 T5b batch-2, 2026-07-09; `tools/canon_sig_reconcile.py`, byte-proven on `func_8013B274`) **The wall (dominant for GIANTS — ~universal, vs ~35% clean-bank for small fns):** a drafter writes an diff --git a/phase-ends/CURRENT_PHASE.md b/phase-ends/CURRENT_PHASE.md index d2e78d9b0..7ff998a7c 100644 --- a/phase-ends/CURRENT_PHASE.md +++ b/phase-ends/CURRENT_PHASE.md @@ -63,11 +63,23 @@ banked set + carve-ownership read from a `.s` splat never emits for matched fns carves** · `p16_permute` `hide_asm` eating GTE `#define`s (permuter silently no-op'd `0s` on ALL renderer drafts) + hardcoded to one overlay. -### NEXT (in priority order) +### NEXT (in priority order) — with the R17 routing call (Drew asked, 2026-07-13) +> **Do NOT read the gcc-2.7.2 source for the sweep blocker.** R17 (read the compiler internals) is for +> **codegen** residuals — regalloc / scheduling / cross-jump / CSE — i.e. things no C change reaches. The +> sweep blocker is a **C FRONT-END diagnostic** (`conflicting types`: two incompatible file-scope decls of one +> identifier in one TU). gcc is correctly rejecting plain C89; the bug is in OUR Python (`reconcile_decls` +> picks a fleet-majority type instead of the type the TU can actually SEE). Reading `cse.c`/`loop.c`/`global.c` +> would tell you nothing. **Triage rule: "the compiler produced the wrong BYTES" → R17. "the compiler refused +> to COMPILE" → our tooling.** + 1. **Unblock the ×133 sweep** (above) → banks 562×133 ≈ 75K templatable ins. Highest ROI, well-diagnosed. -2. **`func_8017BEBC` close=2** — permuter failed; needs a §45-B gdb-on-cc1 read of `allocno_live_length` - (the agent's own recommendation) or a targeted Fable5/Opus follow-up. ×113 reach. -3. **`func_80178D40` close=39** — all in case 0x5C; agent named 4 concrete residuals. Cheap-Opus or permuter. + **Python fix, NOT a gcc read.** +2. **`func_8017BEBC` close=2** (×113) — **THIS is where the gcc-source read belongs.** The permuter failed + (25 min, no close). The agent localized it to `global.c`'s allocno-priority TIE and named the exact move: a + §45-B **gdb-on-cc1 read of `allocno_live_length`** (the original's length quantization plausibly split the + tie). Two instructions from a 107K-ins bank — the best R17 target in the queue. +3. **`func_80178D40` close=39** (×134) — all 39 in case 0x5C; agent named 4 concrete residuals (incl. gcc + peeling a loop iteration the original doesn't → likely `loop.c`). Cheap-Opus/permuter first, R17 if it walls. 4. Then the rest of the 191 heavy jr cores. **R27: prompt Drew before any further Fable5.** ---