mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-06 01:04:13 -04:00
docs(phase-12): T3 substantively complete — REAL 123/146 (85.6%); T3b reassessed/deferred
T3a recovery landed REAL 102->123 (85.62% byte-identical). T3b reassessed under Max: intra-resident dedup collapse has no recovery value left (all 6 h_exact + 9 h_norm group members are individually matched byte-identical) -> deferred as optional source-DRY elegance (the §11 share mechanism is proven; real leverage is the Phase-13 overlays). The ~21 remaining stubs are documented compiler-internal residuals (cross-jump/regalloc) -> honest P9 deferrals (decomp-permuter is deliberate per-function work, not a blind sweep). T3 done at the "substantial not exhaustive" bar. Both binaries byte-identical.
This commit is contained in:
@@ -49,9 +49,10 @@
|
||||
- **Batch 2** (workflow): `resident-harvest-draft` (16 parallel agents) drafted matching C for all 135 unmatched fns (asm + cookbook + worked examples → `.run/drafts/<fn>.c`, no builds/no Ghidra; 14/16 agents ok, 2 hit API-500); `tools/harvest_verify.py` (new) byte-gated each draft vs `8e17e02f` (chunk+bisect, self-correcting). **62/127 verified byte-identical in one pass.** Cleaned 35 redundant `#include`. **REAL 8→70 (48.28%); byte-identical 49.66%.** Clean rebuild green both binaries. Commit `commit:0071`.
|
||||
- **Batch 3** (`commit:0071`→ this): two redraft workflow passes (`resident-harvest-redraft` + retry-resilient `resident-harvest-redraft3`, both seeded by prior drafts + a debugging checklist; the first hit transient server rate-limiting → 8 landed, the retry-wave second pass recovered all 13 batches → +9). Byte-gated via `tools/harvest_verify.py` (drafts2 then drafts3). **REAL 70→78→87 (60.0%); byte-identical 61.38%.** Both binaries clean-rebuild green.
|
||||
- **Batches 3b–5** (`commit:0073`→`commit:0075`): two more workflow passes — retry-resilient redraft (+9→REAL 87), then `tools/match_one.py` (new: per-function isolated compile + relocation-masked diff vs the `.s`) enabling an **iteration loop** (agents compile→read diff→fix), +13→REAL 102. Plus a typedef-strip fix (some drafts inlined `typedef ... u8;` → C89 redefinition compile-fail, not a byte miss; +2).
|
||||
- **HARVEST RESULT (this session): REAL 1 → 102 / 145 = 71.72% byte-identical**, all hand-matched engine C, via 5 ultracode workflow passes + a deterministic byte-gate (`harvest_verify.py`). Both binaries byte-identical (resident `8e17e02f`, main `143dbb89`). New reusable tooling: `harvest_verify.py`, `match_one.py` (→ Phase-13 overlays).
|
||||
- **41 stubs remain, two classes:** (a) **~21 extern-conflict casualties** — match_one MATCHED them standalone but the whole-build TU has a conflicting extern type for a shared symbol (a caller declares a callee `s32` to drop an `andi` while another decl/def says `u16`). Recover by **unifying extern types in `resident.c`** (often widening a definition's return type where byte-identical) — NOT separate TUs (splat places resident as one address-ordered object). (b) **~20 genuine compiler-internal residuals** — cross-jump tail-merge / block-reorder / regalloc the agents documented as **decomp-permuter (`tools/permuter/`) + cookbook §3a** territory (e.g. `func_800D06E8` driven 257→118 masked-word diffs; `func_800D128C` cross-jump). Honest P9 deferrals.
|
||||
- **Still TODO in T3:** the extern-unification recovery (~21) + permuter residuals; intra-resident dedup collapse (6 h_exact/9 h_norm). **Cookbook-worthy idioms found** (R16, fold into §11/§10 at T6): struct-copy prologue (local = global table), void-dispatcher-is-actually-s32-returning, `*10`→`2x+8x` decomposition, masked-compare `andi` survives only when the load's range is unprovable.
|
||||
- **T3a — extern-conflict recovery (`commit:0078`): +20 → REAL 123.** The pass-4 functions that match_one matched standalone but the single-TU build rejected on conflicting shared-symbol extern types were recovered by unifying ~20 symbol types in `resident.c` (widening definitions' return types where byte-identical — `u16 f(){return u16g}` ≡ `s32 f(){…}`; asm-correct widths for globals; per-site `*(u16*)&g` where a neighbor pins the type). 20/21; `func_800D00E4` stays an honest stub (its switch needs the external `jtbl_80113ED8` relocation — analysis preserved under `#if 0`).
|
||||
- **HARVEST RESULT (this session): REAL 1 → 123 / 146 = 85.62% byte-identical**, all hand-matched engine C, via 5 ultracode workflow passes + a deterministic byte-gate + the extern recovery. Both binaries byte-identical (resident `8e17e02f`, main `143dbb89`). New reusable tooling: `harvest_verify.py`, `match_one.py` (→ Phase-13 overlays).
|
||||
- **T3b — REASSESSED & deferred (Max, 2026-06-16).** Intra-resident **dedup collapse**: all 12 members of the 6 h_exact (and the 9 h_norm) groups are now *individually matched byte-identical* → the collapse has **no recovery/count value**, only source-DRY elegance; the §11 share mechanism is already proven (Phase 11), and the real dedup leverage is cross-binary/overlay (Phase 13). Deferred as optional elegance. **Permuter residuals**: the ~21 remaining stubs are the documented compiler-internal tail (cross-jump/block-reorder/regalloc — `func_800D06E8` 257→118, `func_800D128C` cross-jump, etc.) — **honest P9 deferrals**, each documented in its draft header; decomp-permuter is deliberate per-function work, not a blind sweep. **T3 substantively COMPLETE at 85.62%** ("substantial not exhaustive", Drew's bar — crushed).
|
||||
- **Cookbook-worthy idioms found** (folded into cookbook §12 at the ultracode write-up; R16): struct-copy prologue (local = global table), void-dispatcher-is-actually-s32-returning, `*10`→`2x+8x` decomposition, masked-compare `andi` survives only when the load's range is unprovable, callee-return-type-forces-the-cast.
|
||||
- **T4–T6 (revised):** pending.
|
||||
|
||||
## Blockers / decisions
|
||||
|
||||
Reference in New Issue
Block a user