feat(phase-31): wave-C probe — bank func_80181724 + §174 Law 4 (the DEF-side prototype is a wave-prompt law)

- probe 3 tell-cards: 1 MATCH, 2 NEAR (both genuine compiler residuals -> grinder)
- func_80181724 gated 0/1 at standalone MATCH: the TU already declared it (s32,s32) while
  the matching def wanted s16 -> conflicting prototype. Canonical sig + cast-at-use
  ((s16)a0) = identical 13 bytes, re-gated 1/1
- cookbook §174 Law 4 + measured lane economics (tell ~100k tok/card @33% vs adapt
  64-88k/bank @95% gate) + 'a standalone MATCH that gates 0 is a declaration fact'
- 2 NEARs enqueued as permuter fuel (func_8017DAEC count-exact 113=113, role swap)
This commit is contained in:
Drew T
2026-08-14 22:53:40 -06:00
parent 006495b100
commit 6afca3d47e
4 changed files with 867 additions and 822 deletions
+3
View File
@@ -1715,3 +1715,6 @@
{"ts": "2026-08-14 22:02:42", "addr": "0x8017d1e0", "name": "func_8017D1E0", "reach": null, "klass": "schedule", "nins": null, "status": "near", "closeness": 1, "where_stuck": "wave-B NEAR", "best_draft": ".run/wave_p31a/ov_SC02_041/func_8017D1E0.c", "binary": "ov_SC02_041", "source": "warmstart", "residual": null, "passes_tried": null}
{"ts": "2026-08-14 22:02:42", "addr": "0x8017e7b8", "name": "func_8017E7B8", "reach": null, "klass": "regalloc-order", "nins": null, "status": "near", "closeness": 2, "where_stuck": "wave-B NEAR", "best_draft": ".run/wave_p31a/ov_SC03_003/func_8017E7B8.c", "binary": "ov_SC03_003", "source": "warmstart", "residual": null, "passes_tried": null}
{"ts": "2026-08-14 22:02:42", "addr": "0x8017e98c", "name": "func_8017E98C", "reach": null, "klass": "regalloc-order", "nins": null, "status": "near", "closeness": 1, "where_stuck": "wave-B NEAR", "best_draft": ".run/wave_p31a/ov_SC03_003/func_8017E98C.c", "binary": "ov_SC03_003", "source": "warmstart", "residual": null, "passes_tried": null}
{"ts": "2026-08-14 22:48:38", "addr": "0x80181724", "name": "func_80181724", "reach": null, "klass": null, "nins": null, "status": "near", "closeness": 11, "where_stuck": "residual: 11 mismatch", "best_draft": ".run/backlog_drafts/func_80181724.c", "binary": "ov_SC01_009", "source": "worker", "residual": [[1, "afbf0010 sw\tra,16(sp)", "00042400 sll $a0, $a0, 16"], [2, "3c010000 lui\tat,0x0", "00042403 sra $a0, $a0, 16"], [3, "00240821 addu\tat,at,a0", "afbf0010 sw $ra, 0x10($sp)"], [4, "90240000 lbu\ta0,0(at)", "3c018018 lui $at, %hi(D_80183A40)"], [6, "30a500ff andi\ta1,a1,0xff", "90243a40 lbu $a0, %lo(D_80183A40)($at)"], [7, "8fbf0010 lw\tra,16(sp)", "0c00a468 jal func_800291A0"], [8, "27bd0018 addiu\tsp,sp,24", "30a500ff andi $a1, $a1, 0xFF"], [9, "03e00008 jr\tra", "8fbf0010 lw $ra, 0x10($sp)"], [10, "00000000 nop", "27bd0018 addiu $sp, $sp, 0x18"], [11, "--", "03e00008 jr $ra"], [12, "--", "00000000 nop"]], "passes_tried": null}
{"ts": "2026-08-14 22:52:01", "addr": "0x8017daec", "name": "func_8017DAEC", "reach": null, "klass": "regalloc-order", "nins": null, "status": "near", "closeness": 19, "where_stuck": "v0/v1 register-ROLE swap in unk28/unk48/unk2A/unk4C cluster; count-exact 113=113 after the cse_expr \u00a72 hoist-vs-remat fix (nested-block ptr local + output-only asm kill). Prime permuter seed.", "best_draft": ".run/wave_p31c/ov_SC01_077/func_8017DAEC.c", "binary": "ov_SC01_077", "source": "p31-waveC-tell", "residual": null, "passes_tried": null}
{"ts": "2026-08-14 22:52:09", "addr": "0x80186078", "name": "func_80186078", "reach": null, "klass": "schedule", "nins": null, "status": "near", "closeness": 136, "where_stuck": "175 vs 174 ins; sp10/sp18 block fixed (target 15-22 exact); residual = gcc-2.7.2 scheduling cascade in unk90/unk44/unk48/unk4C cluster. Permuter length-profile fuel.", "best_draft": ".run/wave_p31c/ov_SC01_077/func_80186078.c", "binary": "ov_SC01_077", "source": "p31-waveC-tell", "residual": null, "passes_tried": null}
+811 -806
View File
File diff suppressed because it is too large Load Diff
+37
View File
@@ -16661,6 +16661,43 @@ points of gate failure.
priced the lane and named the failure class; 48-card wave B applied it. The lesson transfer is
the yield lever — never fire wave N+1 before reading wave N's failure verdicts (R38).
**Law 4 — the DEF-side prototype is a wave-prompt law too (P31 wave-C probe, 2026-08-14).**
Law 2 tells the drafter to match the TU's decls for *callees and data*. The probe proved the
same constraint binds the **function being defined**, and it silently costs the whole bank:
`func_80181724` reached standalone MATCH (13 ins) and gated **0/1**. Cause: the destination TU
already carried `extern void func_80181724(s32, s32);` (the §8b carried decl layer), while the
matching definition wanted `s16 a0` to emit the entry `sll/sra` pair — a conflicting prototype,
so the whole-binary build fails while `match_one` (which compiles the draft ALONE) is blind to it.
This is §20's DEF-side wall arriving through the *wave* path, and it has a mechanical,
byte-identical answer — **keep the TU's canonical signature and narrow at the USE site**:
```c
/* WRONG — conflicts with the TU's extern; match_one MATCHes, the gate refuses */
void func_80181724(s16 a0, s32 a1) { func_800291A0(D_80183A40[a0], a1 & 0xFF); }
/* RIGHT — same 13 bytes, no conflict: the cast emits the identical sll/sra */
void func_80181724(s32 a0, s32 a1) { func_800291A0(D_80183A40[(s16)a0], a1 & 0xFF); }
```
Re-gated **1/1**. So the prompt clause is: *before choosing your parameter types, grep the
destination TU for an existing `func_<YOURADDR>` declaration; if one exists adopt it verbatim and
move the narrowing into the body.* Prevention again beats recovery — `canon_sig_reconcile` v3.2
performs this same rewrite after the fact, but a prompt sentence costs nothing and never
re-perturbs a correct draft (the §19 "sig_unify REGRESSES canonical drafts" trap).
Corollary for triage: **a standalone MATCH that gates 0 is a declaration fact, never a codegen
fact** — look at the TU's decls before touching the body.
**Lane economics measured (P31 wave C, so future waves price correctly).** The **tell lane**
(§172b LEN+N cards — functions that already survived one drafting attempt) runs ≈100k tok/card
at a **33% standalone rate** (1/3 probe), and its misses are genuine compiler residuals
(register-ROLE swap, schedule cascade) that belong to the permuter, not to more agent effort.
The **adapt lane** runs ~64–88k tok/bank at 75–79% standalone / 95% gate. Tell cards are worth
running once because each bank is real, but **budget the adapt pile first** — and route every
tell-lane NEAR straight to the grinder with its named class (a count-exact near like
`func_8017DAEC` 113=113 with a pure v0/v1 role swap is prime permuter fuel).
Also from the probe: **the card's tell is a hint about the SHAPE of the gap, not a diagnosis** —
in 2 of 3 the real residual was something else (one draft had omitted an entire array lookup;
one had the promotion already satisfied and was actually a §2 cross-call address-cache
hoist-vs-remat). Re-diagnose from the live `match_one` diff; do not trust the tell attribution.
**Ops notes:** the drafter workflow makes NO tree writes (drafts land in `.run/wave_*/`;
match_one is per-fn isolated) so drafting runs concurrently with the grinder — but the GATE is
single-writer: stop the grinder (STOP sentinel) or wait, and note a finished `--once` grinder can
+16 -16
View File
@@ -4,16 +4,16 @@
# cross-binary collapsible-byte leverage: docs/duplicates.cross.md.
# THREE progress metrics (all matter — see the labels):
FLEET fn-count byte-ident: 351163 / 363163 = 96.70% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay)
FLEET instr-weighted : 12887048 / 13523865 = 95.3% (shipped .text across main + resident + 211 overlays; the decomp.dev-DISPLAY number)
FLEET distinct-code(uniq): 5270289 / 5851972 = 90.1% (81428/90929 unique fns; the DISTINCT-RE number)
FLEET fn-count byte-ident: 351170 / 363163 = 96.70% (REAL+LINKED+empties; FUNCTION-count, ×134-inflated — one crack counts per overlay)
FLEET instr-weighted : 12887186 / 13523865 = 95.3% (shipped .text across main + resident + 211 overlays; the decomp.dev-DISPLAY number)
FLEET distinct-code(uniq): 5270302 / 5851972 = 90.1% (81429/90929 unique fns; the DISTINCT-RE number)
MAIN game-code weighted : 436 / 79510 = 0.5% (INCLUDED in the fleet numbers above since 2026-07-22 — roadmap §1 metrics contract; LINKED-excluding Ghidra sig dated 2026-08-05; caveat is R34: no independent second oracle for a PS-X EXE, NOT drift)
(fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 12886612 / 13444355 = 95.9%)
(fleet EXCLUDING main, for continuity with pre-2026-07-22 readings: 12886750 / 13444355 = 95.9%)
FLEET REAL substantive : 348993 (of which dedup-shared 254448 via 2064 groups / 254524 instances)
FLEET REAL substantive : 349000 (of which dedup-shared 254465 via 2072 groups / 254541 instances)
FLEET LINKED PsyQ objs : 959
FLEET NON_MATCHING : 7 (0 in any default build — G4)
FLEET INCLUDE_ASM stubs : 11993
FLEET INCLUDE_ASM stubs : 11986
FLEET matchable : 363163
| binary | REAL | shared | LINKED | byte-ident | matchable | byte-ident % |
@@ -94,16 +94,16 @@ FLEET matchable : 363163
| ov_SC01_000 | 2390 | 1809 | 0 | 2390 | 2403 | 99.5% |
| ov_SC01_001 | 2400 | 1811 | 0 | 2402 | 2466 | 97.4% |
| ov_SC01_004 | 2399 | 1802 | 0 | 2400 | 2414 | 99.4% |
| ov_SC01_005 | 2437 | 1826 | 0 | 2437 | 2503 | 97.4% |
| ov_SC01_006 | 2434 | 1826 | 0 | 2434 | 2503 | 97.2% |
| ov_SC01_005 | 2437 | 1829 | 0 | 2437 | 2503 | 97.4% |
| ov_SC01_006 | 2437 | 1829 | 0 | 2437 | 2503 | 97.4% |
| ov_SC01_008 | 2400 | 1803 | 0 | 2402 | 2426 | 99.0% |
| ov_SC01_009 | 2427 | 1803 | 0 | 2428 | 2507 | 96.8% |
| ov_SC01_009 | 2428 | 1803 | 0 | 2429 | 2507 | 96.9% |
| ov_SC01_074 | 2400 | 1803 | 0 | 2402 | 2426 | 99.0% |
| ov_SC01_077 | 2568 | 1764 | 0 | 2570 | 2586 | 99.4% |
| ov_SC01_080 | 2426 | 1806 | 0 | 2426 | 2512 | 96.6% |
| ov_SC01_084 | 2451 | 1811 | 0 | 2456 | 2579 | 95.2% |
| ov_SC02_000 | 2534 | 1853 | 0 | 2534 | 2683 | 94.4% |
| ov_SC02_003 | 2532 | 1853 | 0 | 2532 | 2683 | 94.4% |
| ov_SC02_000 | 2534 | 1854 | 0 | 2534 | 2683 | 94.4% |
| ov_SC02_003 | 2533 | 1854 | 0 | 2533 | 2683 | 94.4% |
| ov_SC02_004 | 2391 | 1806 | 0 | 2391 | 2401 | 99.6% |
| ov_SC02_005 | 2546 | 1802 | 0 | 2556 | 2927 | 87.3% |
| ov_SC02_011 | 2646 | 1810 | 0 | 2656 | 2893 | 91.8% |
@@ -164,8 +164,8 @@ FLEET matchable : 363163
| ov_SC03_115 | 2437 | 1806 | 0 | 2439 | 2472 | 98.7% |
| ov_SC03_116 | 2404 | 1806 | 0 | 2407 | 2438 | 98.7% |
| ov_SC03_117 | 2483 | 1806 | 0 | 2489 | 2557 | 97.3% |
| ov_SC03_118 | 2571 | 1839 | 0 | 2572 | 2684 | 95.8% |
| ov_SC03_119 | 2569 | 1839 | 0 | 2570 | 2685 | 95.7% |
| ov_SC03_118 | 2571 | 1840 | 0 | 2572 | 2684 | 95.8% |
| ov_SC03_119 | 2569 | 1840 | 0 | 2570 | 2685 | 95.7% |
| ov_SC03_121 | 2407 | 1807 | 0 | 2409 | 2459 | 98.0% |
| ov_SC03_124 | 2597 | 1802 | 0 | 2617 | 2741 | 95.5% |
| ov_SC03_125 | 2534 | 1815 | 0 | 2546 | 2588 | 98.4% |
@@ -184,8 +184,8 @@ FLEET matchable : 363163
| ov_SC04_012 | 2402 | 1806 | 0 | 2403 | 2420 | 99.3% |
| ov_SC04_015 | 2545 | 1807 | 0 | 2556 | 2611 | 97.9% |
| ov_SC04_016 | 2402 | 1806 | 0 | 2404 | 2440 | 98.5% |
| ov_SC04_018 | 2710 | 1858 | 0 | 2710 | 2857 | 94.9% |
| ov_SC04_019 | 2703 | 1858 | 0 | 2703 | 2857 | 94.6% |
| ov_SC04_018 | 2710 | 1861 | 0 | 2710 | 2857 | 94.9% |
| ov_SC04_019 | 2705 | 1861 | 0 | 2705 | 2857 | 94.7% |
| ov_SC04_020 | 2520 | 1815 | 0 | 2532 | 2567 | 98.6% |
| ov_SC04_021 | 2403 | 1808 | 0 | 2403 | 2423 | 99.2% |
| ov_SC05_000 | 2407 | 1810 | 0 | 2410 | 2422 | 99.5% |
@@ -200,7 +200,7 @@ FLEET matchable : 363163
| ov_SC05_009 | 2410 | 1806 | 0 | 2414 | 2438 | 99.0% |
| ov_SC05_010 | 2454 | 1807 | 0 | 2458 | 2588 | 95.0% |
| ov_SC05_011 | 2397 | 1806 | 0 | 2398 | 2409 | 99.5% |
| ov_SC05_017 | 2672 | 1803 | 0 | 2683 | 2842 | 94.4% |
| ov_SC05_017 | 2672 | 1804 | 0 | 2683 | 2842 | 94.4% |
| ov_SC05_018 | 2553 | 1814 | 0 | 2566 | 2673 | 96.0% |
| ov_SC05_019 | 2403 | 1808 | 0 | 2403 | 2423 | 99.2% |
| ov_SC06_000 | 2543 | 1817 | 0 | 2546 | 2691 | 94.6% |