mirror of
https://github.com/Druthulu/BFM-decomp
synced 2026-10-01 07:40:42 -04:00
phase-36: S104 — the census counts a marker on a kept ordinary-C fake (do-while / dead init, Drew's ruling (a)) apart instead of as an orphan; R7 marks its do-while; log: d1–d10 all at 0, R27, the R97 correction for 830650946 | 🛑 T7 RUNNING, census 4,928 / 0 unmarked, exit 0
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
"gte_mnemonics": {
|
||||
"gte_SetRotMatrix": 249,
|
||||
"gte_SetTransMatrix": 229,
|
||||
"gte_avsz3": 25,
|
||||
"gte_avsz4": 56,
|
||||
"gte_dpcl": 134,
|
||||
"gte_ldclmv": 72,
|
||||
@@ -13,6 +12,7 @@
|
||||
"gte_ldv0": 757,
|
||||
"gte_ldv3": 177,
|
||||
"gte_ldv3c": 184,
|
||||
"gte_nccs": 25,
|
||||
"gte_nclip": 108,
|
||||
"gte_rtir": 75,
|
||||
"gte_rtps": 437,
|
||||
@@ -63,32 +63,41 @@
|
||||
"gte/via-macro": 6128,
|
||||
"instruction/direct": 214,
|
||||
"instruction/via-macro": 22,
|
||||
"keepalive/direct": 382,
|
||||
"keepalive/direct": 368,
|
||||
"launder/direct": 729,
|
||||
"launder/via-macro": 42,
|
||||
"verbatim-body/direct": 2682
|
||||
}
|
||||
},
|
||||
"binaries": 218,
|
||||
"cfake_markers": {
|
||||
"count": 4,
|
||||
"sample": [
|
||||
"src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c:7554",
|
||||
"src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c:10112",
|
||||
"src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c:9325",
|
||||
"src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c:6638"
|
||||
]
|
||||
},
|
||||
"classes": {
|
||||
"A": {
|
||||
"bodies": 1720,
|
||||
"distinct_bodies": 799,
|
||||
"bodies": 1713,
|
||||
"distinct_bodies": 797,
|
||||
"file_scope": 0,
|
||||
"in_bodies": 2730,
|
||||
"in_bodies": 2709,
|
||||
"kinds": {
|
||||
"pin": 2730
|
||||
"pin": 2709
|
||||
},
|
||||
"marked": 2730,
|
||||
"sites": 2730,
|
||||
"tus": 1134,
|
||||
"marked": 2709,
|
||||
"sites": 2709,
|
||||
"tus": 1132,
|
||||
"unmarked": 0
|
||||
},
|
||||
"B": {
|
||||
"bodies": 4805,
|
||||
"distinct_bodies": 830,
|
||||
"bodies": 4798,
|
||||
"distinct_bodies": 828,
|
||||
"file_scope": 13,
|
||||
"in_bodies": 11501,
|
||||
"in_bodies": 11487,
|
||||
"kinds": {
|
||||
"asm-body": 13,
|
||||
"barrier": 375,
|
||||
@@ -96,13 +105,13 @@
|
||||
"gte-lever": 456,
|
||||
"gte-unsigned": 271,
|
||||
"instruction": 236,
|
||||
"keepalive": 382,
|
||||
"keepalive": 368,
|
||||
"launder": 771,
|
||||
"verbatim-body": 2682
|
||||
},
|
||||
"marked": 2723,
|
||||
"sites": 11514,
|
||||
"tus": 1441,
|
||||
"marked": 2709,
|
||||
"sites": 11500,
|
||||
"tus": 1439,
|
||||
"unmarked": 8791
|
||||
},
|
||||
"C": {
|
||||
@@ -207,9 +216,9 @@
|
||||
"coverage": {
|
||||
"asm": {
|
||||
"comment_dead": 6786,
|
||||
"live": 15900,
|
||||
"live": 15865,
|
||||
"macro_block": 194,
|
||||
"raw": 22880
|
||||
"raw": 22845
|
||||
},
|
||||
"attribute": {
|
||||
"comment_dead": 0,
|
||||
@@ -225,9 +234,9 @@
|
||||
},
|
||||
"register": {
|
||||
"comment_dead": 8572,
|
||||
"live": 2780,
|
||||
"live": 2759,
|
||||
"macro_block": 18,
|
||||
"raw": 11370
|
||||
"raw": 11349
|
||||
},
|
||||
"volatile": {
|
||||
"comment_dead": 2610,
|
||||
@@ -237,7 +246,7 @@
|
||||
}
|
||||
},
|
||||
"coverage_ok": true,
|
||||
"elapsed_s": 48.7,
|
||||
"elapsed_s": 59.1,
|
||||
"generated": "2026-09-10",
|
||||
"gte_levers": {
|
||||
"direct": 362,
|
||||
@@ -248,15 +257,15 @@
|
||||
"via_macro": 94,
|
||||
"what": "GTE ops whose clobbers exceed the canonical macro's (a scheduling steer): class-B levers INSIDE the headline number since T5 (2026-09-09), marked, 0 at the close"
|
||||
},
|
||||
"head": "910875139",
|
||||
"head": "0d26d8d82",
|
||||
"headers": 3181,
|
||||
"levers_AB": {
|
||||
"asm": 2233,
|
||||
"bodies": 2498,
|
||||
"distinct_bodies": 1077,
|
||||
"marked": 4963,
|
||||
"pins": 2730,
|
||||
"sites": 4963,
|
||||
"asm": 2219,
|
||||
"bodies": 2491,
|
||||
"distinct_bodies": 1075,
|
||||
"marked": 4928,
|
||||
"pins": 2709,
|
||||
"sites": 4928,
|
||||
"unmarked": 0,
|
||||
"what": "register pins + asm statements excluding GTE ops: the classes the phase drives to 0"
|
||||
},
|
||||
@@ -295,16 +304,16 @@
|
||||
5,
|
||||
1
|
||||
],
|
||||
[
|
||||
"DRAW",
|
||||
3,
|
||||
1
|
||||
],
|
||||
[
|
||||
"gte_SetRotMatrix_m",
|
||||
3,
|
||||
2
|
||||
],
|
||||
[
|
||||
"DRAW",
|
||||
3,
|
||||
1
|
||||
],
|
||||
[
|
||||
"gte_rtv0tr_m",
|
||||
2,
|
||||
@@ -374,13 +383,8 @@
|
||||
"total": 314
|
||||
},
|
||||
"orphan_markers": {
|
||||
"count": 4,
|
||||
"sample": [
|
||||
"src/ov_SC02_041/ov_SC02_041_jr_8017BEBC.c:7554",
|
||||
"src/ov_SC04_002/ov_SC04_002_jr_8017BEBC.c:10112",
|
||||
"src/ov_SC04_005/ov_SC04_005_jr_8017BEBC.c:9325",
|
||||
"src/ov_SC04_007/ov_SC04_007_jr_8017BEBC.c:6638"
|
||||
]
|
||||
"count": 0,
|
||||
"sample": []
|
||||
},
|
||||
"per_tu_asm_macro_definitions": {
|
||||
"by_kind": {
|
||||
@@ -415,12 +419,12 @@
|
||||
"$23": 10,
|
||||
"$25": 1,
|
||||
"$29": 13,
|
||||
"$3": 238,
|
||||
"$3": 231,
|
||||
"$4": 538,
|
||||
"$5": 397,
|
||||
"$6": 73,
|
||||
"$7": 41,
|
||||
"$8": 36,
|
||||
"$7": 34,
|
||||
"$8": 29,
|
||||
"$9": 22,
|
||||
"7": 1,
|
||||
"a0": 7,
|
||||
@@ -428,30 +432,30 @@
|
||||
"v0": 2,
|
||||
"v1": 3
|
||||
},
|
||||
"sites": 2730,
|
||||
"sites": 2709,
|
||||
"sp": 13,
|
||||
"spelling": {
|
||||
"__asm__": 2690,
|
||||
"__asm__": 2669,
|
||||
"asm": 40
|
||||
},
|
||||
"volatile_qualified": 3,
|
||||
"zero": 102
|
||||
},
|
||||
"src_stamp": "84d09a277511cae6",
|
||||
"src_stamp": "e30a2a0650aadea9",
|
||||
"tus": 4121,
|
||||
"unclassified": 0,
|
||||
"union_AD": {
|
||||
"bodies": 6223,
|
||||
"bodies": 6216,
|
||||
"by_kind": {
|
||||
"main": 165,
|
||||
"md": 122,
|
||||
"ov": 5751,
|
||||
"ov": 5746,
|
||||
"resident": 10,
|
||||
"shared": 175
|
||||
"shared": 173
|
||||
},
|
||||
"copies_in_multi": 5014,
|
||||
"distinct_bodies": 1377,
|
||||
"multi_copy_classes": 168
|
||||
"copies_in_multi": 5007,
|
||||
"distinct_bodies": 1375,
|
||||
"multi_copy_classes": 166
|
||||
},
|
||||
"verbatim_excluded": {
|
||||
"functions": 13,
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
lever_census: 218 binaries · 4,121 TUs + 3,181 headers · coverage OK · unclassified 0 · verbatim excluded 13 fn / 14 sites (manifest 13)
|
||||
coverage asm raw 22880 = live 15900 + macro-block 194 + comment/dead 6786
|
||||
coverage register raw 11370 = live 2780 + macro-block 18 + comment/dead 8572
|
||||
coverage asm raw 22845 = live 15865 + macro-block 194 + comment/dead 6786
|
||||
coverage register raw 11349 = live 2759 + macro-block 18 + comment/dead 8572
|
||||
coverage volatile raw 4399 = live 1707 + macro-block 82 + comment/dead 2610
|
||||
coverage builtin raw 599 = live 445 + macro-block 0 + comment/dead 154
|
||||
coverage attribute raw 76 = live 76 + macro-block 0 + comment/dead 0
|
||||
class sites in-bodies file-scope bodies distinct TUs marked unmarked kinds
|
||||
A pins 2730 2730 0 1720 799 1134 2730 0 {'pin': 2730}
|
||||
B asm 11514 11501 13 4805 830 1441 2723 8791 {'barrier': 375, 'keepalive': 382, 'instruction': 236, 'gte-lever': 456, 'launder': 771, 'gte': 6328, 'gte-unsigned': 271, 'asm-body': 13, 'verbatim-body': 2682}
|
||||
C volatile 1590 1438 152 496 95 610 14 1576 {'decl-body': 58, 'cast': 1378, 'decl-file': 152, 'param': 2}
|
||||
A pins 2709 2709 0 1713 797 1132 2709 0 {'pin': 2709}
|
||||
B asm 11500 11487 13 4798 828 1439 2709 8791 {'gte': 6328, 'barrier': 375, 'gte-lever': 456, 'gte-unsigned': 271, 'launder': 771, 'instruction': 236, 'asm-body': 13, 'keepalive': 368, 'verbatim-body': 2682}
|
||||
C volatile 1590 1438 152 496 95 610 14 1576 {'decl-body': 58, 'decl-file': 152, 'cast': 1378, 'param': 2}
|
||||
D register 50 50 0 47 47 6 0 50 {'register': 50}
|
||||
E asm-label 7782 1359 6423 1091 154 2090 0 7782 {'asm-label': 7782}
|
||||
F builtin 445 445 0 428 27 302 0 445 {'builtin': 445}
|
||||
G attribute 76 1 75 1 1 40 0 76 {'attribute': 76}
|
||||
UNION A–D: 6,223 bodies · 1,377 distinct (addresses normalized) · 168 multi-copy classes holding 5,014 bodies · by kind {'ov': 5751, 'md': 122, 'main': 165, 'shared': 175, 'resident': 10}
|
||||
THE PHASE'S NUMBER (pins + asm statements, GTE excluded): 4,963 sites in 2,498 bodies (1,077 distinct) · marked !FAKE 4,963 · UNMARKED 0
|
||||
orphan !FAKE markers (no pin/asm site on the line nor below): 4
|
||||
UNION A–D: 6,216 bodies · 1,375 distinct (addresses normalized) · 166 multi-copy classes holding 5,007 bodies · by kind {'ov': 5746, 'main': 165, 'md': 122, 'resident': 10, 'shared': 173}
|
||||
THE PHASE'S NUMBER (pins + asm statements, GTE excluded): 4,928 sites in 2,491 bodies (1,075 distinct) · marked !FAKE 4,928 · UNMARKED 0
|
||||
orphan !FAKE markers (no pin/asm site on the line nor below): 0
|
||||
marked ordinary-C fakes kept by Drew's S104 ruling (a) (`do { } while (0)`, dead initialisers; NOT levers): 4
|
||||
GTE levers (clobbers beyond the canonical macro's): 456 sites (94 via a variant macro, 362 direct) · marked 456 · UNMARKED 0 · unsigned GTE statements 271
|
||||
per-TU asm macro definitions outside the GTE header: 314 {'launder': 154, 'gte': 150, 'instruction': 9, 'barrier': 1} (GTE variants 64)
|
||||
pins: 2,730 · $0 102 · $sp 13 · with initializer 270 · volatile-qualified 3 · bare-name 15 · spellings {'__asm__': 2690, 'asm': 40}
|
||||
per-TU asm macro definitions outside the GTE header: 314 {'gte': 150, 'launder': 154, 'instruction': 9, 'barrier': 1} (GTE variants 64)
|
||||
pins: 2,709 · $0 102 · $sp 13 · with initializer 270 · volatile-qualified 3 · bare-name 15 · spellings {'__asm__': 2669, 'asm': 40}
|
||||
whole-body asm routines in C shells, manifest PERMANENT (hand asm, NOT levers): 22 routines · 2,682 sites (2,660 private copies + 22 shared headers); asm-bodies NOT permanent (levers): 13 site(s) ['func_8001E378:DECOMPILE-NOW', 'func_80020F34:DECOMPILE-NOW', 'func_800249F0:DECOMPILE-NOW', 'func_80025CBC:DECOMPILE-NOW', 'func_80026514:UNCERTAIN', 'func_800268D0:UNCERTAIN', 'func_80027058:DECOMPILE-NOW', 'func_80027200:DECOMPILE-NOW', 'func_800CBA44:DECOMPILE-NOW', 'func_8017D810:DECOMPILE-NOW', 'func_8017E26C:UNCERTAIN', 'func_80184440:DECOMPILE-NOW', 'func_801A3BCC:DECOMPILE-NOW']
|
||||
asm kinds: {'asm-body/direct': 13, 'barrier/direct': 373, 'barrier/via-macro': 2, 'gte/direct': 200, 'gte/via-macro': 6128, 'gte-lever/direct': 362, 'gte-lever/via-macro': 94, 'gte-unsigned/direct': 271, 'instruction/direct': 214, 'instruction/via-macro': 22, 'keepalive/direct': 382, 'launder/direct': 729, 'launder/via-macro': 42, 'verbatim-body/direct': 2682}
|
||||
instruction mnemonics: {'la': 142, 'addu': 23, 'addiu': 22, 'RTP_SND': 22, '.section': 7, 'lui': 4, 'move': 4, 'lh': 3, 'and': 2, 'nop': 1, 'srl': 1, 'mult': 1, 'mfhi': 1, 'sll': 1, 'li': 1, 'lw': 1}
|
||||
gte mnemonics: {'gte_ldv0': 757, 'gte_stlvnl': 593, 'gte_stsxy': 447, 'gte_rtps': 437, 'gte_stflg': 415, 'gte_rtpt': 352, 'gte_SetRotMatrix': 249, 'gte_stsxy3': 236, 'gte_SetTransMatrix': 229, 'gte_rtv0tr': 228, 'gte_ldv3c': 184, 'gte_ldv3': 177, 'gte_stsv': 161, 'lwc2': 159, 'gte_stsz4': 149, 'gte_stsz3': 147, 'gte_stszotz': 134, 'gte_dpcl': 134, 'gte_stsxy3_f3': 111, 'gte_nclip': 108, 'gte_stopz': 108, 'gte_stsxy3c': 108, 'gte_stclmv': 108, 'gte_stsxy3_ft3': 79, 'gte_rtir': 75, 'gte_ldclmv': 72, 'gte_avsz4': 56, 'gte_stotz': 52, 'gte_ldrgb': 30, 'gte_avsz3': 25}
|
||||
asm-bearing macro definitions: 314 (20 names, 3 with >1 text) kinds {'launder': 154, 'gte': 150, 'instruction': 9, 'barrier': 1}
|
||||
asm kinds: {'asm-body/direct': 13, 'barrier/direct': 373, 'barrier/via-macro': 2, 'gte/direct': 200, 'gte/via-macro': 6128, 'gte-lever/direct': 362, 'gte-lever/via-macro': 94, 'gte-unsigned/direct': 271, 'instruction/direct': 214, 'instruction/via-macro': 22, 'keepalive/direct': 368, 'launder/direct': 729, 'launder/via-macro': 42, 'verbatim-body/direct': 2682}
|
||||
instruction mnemonics: {'la': 142, 'addu': 23, 'addiu': 22, 'RTP_SND': 22, '.section': 7, 'lui': 4, 'move': 4, 'lh': 3, 'and': 2, 'mult': 1, 'mfhi': 1, 'sll': 1, 'li': 1, 'lw': 1, 'nop': 1, 'srl': 1}
|
||||
gte mnemonics: {'gte_ldv0': 757, 'gte_stlvnl': 593, 'gte_stsxy': 447, 'gte_rtps': 437, 'gte_stflg': 415, 'gte_rtpt': 352, 'gte_SetRotMatrix': 249, 'gte_stsxy3': 236, 'gte_SetTransMatrix': 229, 'gte_rtv0tr': 228, 'gte_ldv3c': 184, 'gte_ldv3': 177, 'gte_stsv': 161, 'lwc2': 159, 'gte_stsz4': 149, 'gte_stsz3': 147, 'gte_stszotz': 134, 'gte_dpcl': 134, 'gte_stsxy3_f3': 111, 'gte_stclmv': 108, 'gte_nclip': 108, 'gte_stopz': 108, 'gte_stsxy3c': 108, 'gte_stsxy3_ft3': 79, 'gte_rtir': 75, 'gte_ldclmv': 72, 'gte_avsz4': 56, 'gte_stotz': 52, 'gte_ldrgb': 30, 'gte_nccs': 25}
|
||||
asm-bearing macro definitions: 314 (20 names, 3 with >1 text) kinds {'gte': 150, 'launder': 154, 'instruction': 9, 'barrier': 1}
|
||||
controls (R39):
|
||||
src/800.c func_800226C0 pins got 14 expected 45 N-A
|
||||
src/shared/ov/func_80178004.h pins got 8 expected 26 N-A
|
||||
ov_SC03_006 func_80184034 bare-name pins got 0 expected 3 N-A
|
||||
engine_prelude.h asm sites (a macro definition only) got 0 expected 0 OK
|
||||
elapsed 48.7 s
|
||||
elapsed 59.1 s
|
||||
|
||||
@@ -1820,6 +1820,10 @@ 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.
|
||||
- **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 —
|
||||
`lever_census` counts it apart ("marked ordinary-C fakes … NOT levers") and `--scrub` leaves it. Generator R7's do-while
|
||||
spelling now carries `// !FAKE: do-while — a LOOP-note scheduling barrier (sched.c:2058-2074; P36 R7)`.
|
||||
- **Generator R27 `named_ports` (`tools/delever.py`, S104; `delever_regen --families R27`)** — the SAME function already
|
||||
lever-free in another binary, ported. Donors: every definition of the name in `src/` (`named_definitions()`, one `git
|
||||
grep`, cached) with no `register`/`__asm__`/`!FAKE`, nearest line count first, ≤ 6 distinct texts. Symbol renaming by
|
||||
|
||||
@@ -1844,6 +1844,24 @@ accumulate here as the phase produces them.**
|
||||
`src/shared/ov/func_80166F58__3728db8a.h` — a naive splice COMPILE-ERRORs, so d2 ports it), d3 `func_8017FB4C` ov_SC06_014 ×4 (4),
|
||||
d4 `func_80182358` ov_SC04_007 ×4 (5), d5 `func_801837E8` ov_SC05_018 ×4 (5). METHOD_S103.md gained the S104 section (steps 8–11:
|
||||
do-while marked per sotn, the minimum-lever fallback, the structs question, start from the sweep's best).
|
||||
- **S104 — the first landings: d1–d10 ALL at 0; nine with ZERO levers, d4 with one marked do-while.** d1 `func_80185960` (if/else,
|
||||
non-simple value in the ELSE arm, `jump.c:739-741`; 10 bodies), d2 `func_80166F58` MAIN_012 (the banked SC04_011 header ported +
|
||||
a re-extended short copy; 8), d3 `func_8017FB4C` (goto chain → structured if/else, a flag test reordered for a `sched.c:2428`
|
||||
tie-break; 4), d4 `func_80182358` (a marked `do { store; } while (0)` LOOP-note barrier; 4), d5 `func_801837E8` (a hoisted temp
|
||||
folded into `+=`: local-alloc's three-quantity order is by BIRTH, `local-alloc.c:1486-1507`; 4), d6 `func_8017B614` SC07_010
|
||||
(ported from ov_SC01_000; 8), d7 `func_80181B18` (locals declared per switch case, `local-alloc.c:2101-2106`; 6 + ports), d8
|
||||
`func_80186440` (`(*(u16 *)(p + 2))++`: a SUBREG destination fails `birthing_insn_p`; 4), d9 `func_801F2348` (a goto chain → a
|
||||
structured `||`; 3 + 4 sibling ports), **d10 `func_8017EF88` + `func_8017F040` (3 pins + 2 keepalives + a do-while + a dead
|
||||
pad → REGISTER UNIONS `{ struct { s16 x, y; } v; s32 w; }` — the first proof case of Drew's struct hypothesis: a field insert
|
||||
makes flow mark the union live from entry, `global.c:640-660`; 5)**. Sweep banks: 5 classes + 12 siblings. R22 `check-all:
|
||||
218 passed, 0 failed of 218`; census 5,097 → 4,963 → **4,928**. **Generator R27 `named_ports`** (d2/d6's port made mechanical:
|
||||
the two ORIGINAL objects' relocation sequences paired in order, file-scope externs carried, the target's return type): 511 of
|
||||
1,010 residue classes have a lever-free same-name donor; probe 4/24 at the first candidate; the R27 pass over the residue is
|
||||
running (13 MATCH in its first 330). **R97 correction:** commit `830650946` wrote "census … 0 unmarked" from the output line
|
||||
while `lever_census --check` EXITED 1 on four ORPHAN markers — d4's marked do-while and its three ports; the census now counts a
|
||||
marker on a kept ordinary-C fake apart (Drew's ruling (a), sotn's rule) and exits 0 (`4,928 … 0 UNMARKED — OK`, exit 0, 4
|
||||
marked ordinary-C fakes); R7's do-while now carries the marker. **Open for T9:** the tree's `LOAD-BEARING CONSTRUCTS` header
|
||||
comments (232 files) still describe levers their banked bodies no longer have (e.g. `func_8017EF88`'s) — a stale-comment pass.
|
||||
|
||||
## 🛑 SESSION CHECKPOINT — S103 (2026-09-10, refreshed at the session's end): T0–T6 ☑, **T7 RUNNING**. 24,119 → **5,097 sites** this session (−19,022); 56 agent draws; generators **R22–R26**; `delever_regen` + `delever --port-scan`; **the MINIMUM-LEVER pivot** (four 130-copy classes now carry 1-2 marked levers instead of 4-34); R22 `check-all: 218 passed, 0 failed of 218` at every bank | `lever_census --check` OK, exit 0 (5,097 marked, 0 UNMARKED, 0 orphans) · the session's last commit follows
|
||||
|
||||
|
||||
+1
-1
@@ -1506,7 +1506,7 @@ def block_wraps(text, tu, fn, d_):
|
||||
if not simple_stmt(s):
|
||||
continue
|
||||
stmt = raw_line.strip()
|
||||
for tag, spelling in (("block", f"{indent}{{ {stmt} }}"), ("do-while", f"{indent}do {{ {stmt} }} while (0);")):
|
||||
for tag, spelling in (("block", f"{indent}{{ {stmt} }}"), ("do-while", f"{indent}do {{ {stmt} }} while (0); // !FAKE: do-while — a LOOP-note scheduling barrier (sched.c:2058-2074; P36 R7)")):
|
||||
cand = list(lines)
|
||||
cand[i] = spelling
|
||||
out.append((f"{tag} @{i + 1}", "\n".join(cand)))
|
||||
|
||||
+13
-2
@@ -81,6 +81,7 @@ MIPS_REG_NAMES = {"zero", "at", "v0", "v1", "a0", "a1", "a2", "a3", "t0", "t1",
|
||||
GTE_MNEMONICS = {"lwc2", "swc2", "mtc2", "mfc2", "ctc2", "cfc2", "cop2", "rtps", "rtpt", "nclip", "ncds", "nccs", "ncdt", "ncct",
|
||||
"ncs", "nct", "cdp", "cc", "dpcs", "dpct", "dpcl", "intpl", "sqr", "op", "gpf", "gpl", "avsz3", "avsz4", "mvmva"}
|
||||
FAKE_MARK = "!FAKE:"
|
||||
C_FAKE_RX = re.compile(r"while\s*\(\s*0\s*\)|!FAKE:\s*(?:do-while|dead-init)")
|
||||
NON_LEVER_KINDS = {"gte", "verbatim-body", "gte-unsigned"} # Sony's coprocessor idiom; a manifest-listed hand-asm routine — censused, never a lever
|
||||
GTE_LEVER_KIND = "gte-lever" # a GTE op whose clobbers exceed its canonical's (a `_m`/`_v` variant macro, or a direct statement): a steer
|
||||
GTE_VARIANT_NAME = re.compile(r"(_m|_v[0-9a-f]{4})$")
|
||||
@@ -708,10 +709,15 @@ def walk_file(raw, rel, is_header, global_names=None):
|
||||
# orphan markers: a `// !FAKE:` line with no class A/B site on it, and none on the line below either (unless that line carries its own
|
||||
# marker) — a stale honesty claim (a marked site later removed or rewritten; the delever tool consumes a trailing marker, --scrub cleans)
|
||||
ab_lines = {s["line"] for s in sites if s["cls"] in "AB"}
|
||||
# a marker on a KEPT ordinary-C fake — `do { … } while (0)` or a dead initialiser — is Drew's S104 ruling (a) and
|
||||
# sotn-decomp's STYLE.md rule: the fake stays as C and carries `// !FAKE:`. Counted apart; never an orphan, never a lever.
|
||||
cfake = [ln for ln, l in enumerate(raw_lines, start=1) if FAKE_MARK in l and C_FAKE_RX.search(l)]
|
||||
orphans = [ln for ln, l in enumerate(raw_lines, start=1)
|
||||
if FAKE_MARK in l and ln not in ab_lines and not (ln + 1 in ab_lines and FAKE_MARK not in raw_line(ln + 1))]
|
||||
if FAKE_MARK in l and ln not in ab_lines and not (ln + 1 in ab_lines and FAKE_MARK not in raw_line(ln + 1))
|
||||
and ln not in cfake]
|
||||
return dict(rel=rel, sites=sites, defs=[dict(name=d["name"], line=d["line"], end=d["end"], nhash=d["nhash"], nlines=d["nlines"]) for d in defs],
|
||||
macro_defs=mdefs, coverage=cov, live_tokens=live_tokens, roled=len(roles), unclassified=unclassified, orphan_markers=orphans)
|
||||
macro_defs=mdefs, coverage=cov, live_tokens=live_tokens, roled=len(roles), unclassified=unclassified, orphan_markers=orphans,
|
||||
cfake_markers=cfake)
|
||||
|
||||
|
||||
def _walk_worker(args):
|
||||
@@ -819,6 +825,7 @@ def run_census(jobs, use_cache=True, out_dir=OUT_DIR_DEFAULT, want_sites=False,
|
||||
# attribute aliases, exclude the verbatim bodies, gather
|
||||
sites, defs_all, mdefs_all, unclassified = [], [], [], []
|
||||
orphan_all = []
|
||||
cfake_all = []
|
||||
cov_total = {k: collections.Counter() for k in TOKEN_CLASSES}
|
||||
verbatim_sites = 0
|
||||
verbatim_fns = set()
|
||||
@@ -859,6 +866,7 @@ def run_census(jobs, use_cache=True, out_dir=OUT_DIR_DEFAULT, want_sites=False,
|
||||
mdefs_all.append(dict(md, tu=rel))
|
||||
unclassified.extend(r["unclassified"])
|
||||
orphan_all.extend(f"{rel}:{ln}" for ln in r.get("orphan_markers", ()))
|
||||
cfake_all.extend(f"{rel}:{ln}" for ln in r.get("cfake_markers", ()))
|
||||
for k, c in r["coverage"].items():
|
||||
cov_total[k].update(c)
|
||||
coverage = {k: dict(v) for k, v in cov_total.items()}
|
||||
@@ -903,6 +911,7 @@ def run_census(jobs, use_cache=True, out_dir=OUT_DIR_DEFAULT, want_sites=False,
|
||||
generated=time.strftime("%Y-%m-%d"), binaries=len(aliases), tus=len(tu_aliases), headers=len(headers),
|
||||
head=git_head(), src_stamp=src_stamp(),
|
||||
orphan_markers=dict(count=len(orphan_all), sample=orphan_all[:40]),
|
||||
cfake_markers=dict(count=len(cfake_all), sample=cfake_all[:40]),
|
||||
coverage=coverage, coverage_ok=cov_ok, unclassified=len(unclassified),
|
||||
verbatim_excluded=dict(sites=verbatim_sites, functions=len(verbatim_fns), manifest_rows=len(verb)),
|
||||
classes=classes,
|
||||
@@ -1020,6 +1029,8 @@ def render(s):
|
||||
L.append(f" THE PHASE'S NUMBER (pins + asm statements, GTE excluded): {ab['sites']:,} sites in {ab['bodies']:,} bodies "
|
||||
f"({ab['distinct_bodies']:,} distinct) · marked !FAKE {ab['marked']:,} · UNMARKED {ab['unmarked']:,}")
|
||||
L.append(f" orphan !FAKE markers (no pin/asm site on the line nor below): {s.get('orphan_markers', {}).get('count', 0)}")
|
||||
L.append(f" marked ordinary-C fakes kept by Drew's S104 ruling (a) (`do {{ }} while (0)`, dead initialisers; NOT levers): "
|
||||
f"{s.get('cfake_markers', {}).get('count', 0)}")
|
||||
g = s.get("gte_levers", {})
|
||||
if g:
|
||||
L.append(f" GTE levers (clobbers beyond the canonical macro's): {g['sites']:,} sites ({g['via_macro']:,} via a variant macro, {g['direct']:,} direct) · "
|
||||
|
||||
Reference in New Issue
Block a user