From 39e3e1851f2e17acb9cb12c5e9100101ab94a70d Mon Sep 17 00:00:00 2001 From: Drew T <50529377+Druthulu@users.noreply.github.com> Date: Wed, 9 Sep 2026 02:45:58 -0600 Subject: [PATCH] =?UTF-8?q?phase-36:=20T3=20(tools)=20=E2=80=94=20tools/de?= =?UTF-8?q?lever.py=20the=20campaign=20tool:=20--plan/--apply=20(the=20fil?= =?UTF-8?q?e=20is=20the=20write=20unit,=20its=20final=20compile=20through?= =?UTF-8?q?=20every=20recipe=20the=20proof;=20'done'=20=3D=20a=20ledger=20?= =?UTF-8?q?fact=20keyed=20by=20the=20body's=20normalized=20text=20before/a?= =?UTF-8?q?fter;=20replay=20from=20an=20exemplar=20in=20one=20compile;=20!?= =?UTF-8?q?FAKE=20markers=20on=20class=20A/B=20survivors;=20--restore=20fr?= =?UTF-8?q?om=20inflight.json;=20--apply-body=20for=20T6/T7;=20a=20selftes?= =?UTF-8?q?t=20with=20a=20stub=20oracle),=20the=20launder-ASSIGNMENT=20rew?= =?UTF-8?q?rite=20(989=20of=204,793=20direct=20launders=20=E2=80=94=20dele?= =?UTF-8?q?ting=20them=20made=20cc1=202.7.2=20abort:=20the=20probe's=20'Do?= =?UTF-8?q?ne'=20error,=20reproduced=203/3),=20macro=20shapes=20(SHB=20del?= =?UTF-8?q?eted,=20a=20launder=20expression=20valued,=20compound=20macros?= =?UTF-8?q?=20refused=20for=20T5),=20the=20oracle's=20COMPILE-CRASH=20verd?= =?UTF-8?q?ict=20+=20judge=5Fall=20+=20the=20mtime=20restore,=20the=20cens?= =?UTF-8?q?us's=20src=5Fstamp/head,=20tools/delever=5Fcycle.sh=20(apply=20?= =?UTF-8?q?=E2=86=92=20R22=20=E2=86=92=20census=20=E2=86=92=20log=20+=20he?= =?UTF-8?q?adline=20=E2=86=92=20commit);=20selftest=20OK;=20census=2053,23?= =?UTF-8?q?4=20unchanged;=20calibration=20177/177;=20plan=20ov=5FSC04=5F01?= =?UTF-8?q?1=20=3D=2018=20files=20/=20176=20bodies=20/=20540=20sites;=20SE?= =?UTF-8?q?TUP=20+=20dictionary=20rows;=20kit=20corpus;=20T7=20waves=20nee?= =?UTF-8?q?d=20Drew's=20direct=20approval=20(decisions)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + .run/P36/census/lever_census.json | 4 +- .run/P36/census/lever_census.txt | 4 +- .run/P36/delever/calibration.json | 352 ++--- config/tool_dictionary.tsv | 3 +- decomp-architect/corpus/tools/INDEX.md | 7 +- decomp-architect/corpus/tools/P10/delever.py | 1251 +++++++++++++++-- .../corpus/tools/P10/delever_cycle.sh | 67 + .../corpus/tools/P10/delever_oracle.py | 36 +- .../corpus/tools/P10/lever_census.py | 17 + decomp-architect/tools/MANIFEST.md | 7 +- docs/SETUP.md | 3 +- docs/tool-index.md | 9 +- phase-ends/CURRENT_PHASE.md | 50 +- tools/delever.py | 1251 +++++++++++++++-- tools/delever_cycle.sh | 67 + tools/delever_oracle.py | 36 +- tools/lever_census.py | 17 + 18 files changed, 2688 insertions(+), 494 deletions(-) create mode 100644 decomp-architect/corpus/tools/P10/delever_cycle.sh create mode 100644 tools/delever_cycle.sh diff --git a/.gitignore b/.gitignore index 3a4c5d2093..88d8bd746b 100644 --- a/.gitignore +++ b/.gitignore @@ -485,6 +485,7 @@ unsloth_compiled_cache/ !/.run/P36/delever/*.log !/.run/P36/delever/*.json /.run/P36/delever/recipes.json +/.run/P36/delever/inflight.json !/.run/P36/delever/*.jsonl !/.run/P36/delever/*.txt !/.run/P36/permuter/ diff --git a/.run/P36/census/lever_census.json b/.run/P36/census/lever_census.json index 6999949d5b..8aa4707a06 100644 --- a/.run/P36/census/lever_census.json +++ b/.run/P36/census/lever_census.json @@ -229,8 +229,9 @@ } }, "coverage_ok": true, - "elapsed_s": 40.0, + "elapsed_s": 36.0, "generated": "2026-09-09", + "head": "89676f096", "headers": 3181, "levers_AB": { "asm": 15514, @@ -434,6 +435,7 @@ "volatile_qualified": 136, "zero": 1337 }, + "src_stamp": "8be8c2a58e0ebac7", "tus": 4121, "unclassified": 0, "union_AD": { diff --git a/.run/P36/census/lever_census.txt b/.run/P36/census/lever_census.txt index a2b36071f1..ddc0ee44e9 100644 --- a/.run/P36/census/lever_census.txt +++ b/.run/P36/census/lever_census.txt @@ -12,7 +12,7 @@ lever_census: 218 binaries · 4,121 TUs + 3,181 headers · coverage OK · unclas E asm-label 7428 1005 6423 737 117 2080 0 7428 {'asm-label': 7428} 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: 19,156 bodies · 2,537 distinct (addresses normalized) · 488 multi-copy classes holding 17,107 bodies · by kind {'ov': 18330, 'shared': 393, 'md': 213, 'main': 204, 'resident': 16} + UNION A–D: 19,156 bodies · 2,537 distinct (addresses normalized) · 488 multi-copy classes holding 17,107 bodies · by kind {'ov': 18330, 'md': 213, 'shared': 393, 'main': 204, 'resident': 16} THE PHASE'S NUMBER (pins + asm statements, GTE excluded): 53,234 sites in 15,679 bodies (2,227 distinct) · marked !FAKE 0 · UNMARKED 53,234 pins: 37,720 · $0 1,337 · $sp 13 · with initializer 5,140 · volatile-qualified 136 · bare-name 76 · spellings {'__asm__': 37510, 'asm': 210} 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'] @@ -25,4 +25,4 @@ lever_census: 218 binaries · 4,121 TUs + 3,181 headers · coverage OK · unclas src/shared/ov/func_80178004.h pins got 26 expected 26 OK ov_SC03_006 func_80184034 bare-name pins got 3 expected 3 OK engine_prelude.h asm sites (a macro definition only) got 0 expected 0 OK - elapsed 40.0 s + elapsed 36.0 s diff --git a/.run/P36/delever/calibration.json b/.run/P36/delever/calibration.json index f9a78a0f3c..c2f7380ac0 100644 --- a/.run/P36/delever/calibration.json +++ b/.run/P36/delever/calibration.json @@ -1,7 +1,7 @@ { - "head": "a1407bdfc", + "head": "89676f096", "stamp": "b44c5a8a3423", - "generated": "2026-09-09 01:50", + "generated": "2026-09-09 02:38", "aliases": [ "main", "ov_SC03_014", @@ -21,207 +21,207 @@ "main": { "objects": 85, "identical": 85, - "seconds": 6.707000000000002, - "mean_s": 0.079 + "seconds": 7.229000000000001, + "mean_s": 0.085 }, "ov_SC03_014": { "objects": 32, "identical": 32, - "seconds": 4.815, - "mean_s": 0.15 + "seconds": 5.186000000000002, + "mean_s": 0.162 }, "ov_SC03_015": { "objects": 32, "identical": 32, - "seconds": 4.541, - "mean_s": 0.142 + "seconds": 4.574999999999999, + "mean_s": 0.143 }, "ov_SC04_011": { "objects": 28, "identical": 28, - "seconds": 3.943, + "seconds": 3.9430000000000005, "mean_s": 0.141 } }, "per_object_seconds": { - "build/src/800.o": 0.752, - "build/src/800_b.o": 0.07, - "build/src/800_b_2.o": 0.329, - "build/src/800_b_o0a.o": 0.074, - "build/src/800_c.o": 0.195, - "build/src/800b2.o": 0.078, - "build/src/apicard1.o": 0.061, - "build/src/apicard2.o": 0.069, - "build/src/apicard3.o": 0.076, - "build/src/apicard4.o": 0.066, - "build/src/apicard5.o": 0.086, - "build/src/apicard6.o": 0.072, - "build/src/apicard7.o": 0.081, - "build/src/boot.o": 0.08, - "build/src/gap.o": 0.071, - "build/src/libapi1.o": 0.07, - "build/src/libapi2.o": 0.063, - "build/src/libc2_1.o": 0.064, - "build/src/libc2_2.o": 0.059, - "build/src/libcd1.o": 0.069, - "build/src/libcd2.o": 0.065, - "build/src/libetc.o": 0.062, - "build/src/libgpu.o": 0.059, - "build/src/libgpu2.o": 0.067, - "build/src/libgs1.o": 0.057, - "build/src/libgs2.o": 0.064, - "build/src/libgs3.o": 0.057, - "build/src/libgs4.o": 0.064, - "build/src/libgs5.o": 0.057, - "build/src/libgs6.o": 0.077, - "build/src/libgs7.o": 0.061, - "build/src/libgs8.o": 0.059, - "build/src/libgte1.o": 0.055, - "build/src/libgte10.o": 0.065, - "build/src/libgte11.o": 0.063, - "build/src/libgte12.o": 0.061, - "build/src/libgte13.o": 0.056, - "build/src/libgte14.o": 0.058, - "build/src/libgte15.o": 0.071, - "build/src/libgte16.o": 0.063, - "build/src/libgte17.o": 0.063, - "build/src/libgte18.o": 0.061, - "build/src/libgte19.o": 0.063, - "build/src/libgte2.o": 0.061, - "build/src/libgte20.o": 0.066, - "build/src/libgte21.o": 0.058, - "build/src/libgte22.o": 0.063, - "build/src/libgte23.o": 0.064, - "build/src/libgte24.o": 0.057, - "build/src/libgte25.o": 0.061, - "build/src/libgte26.o": 0.068, - "build/src/libgte27.o": 0.062, - "build/src/libgte28.o": 0.06, + "build/src/800.o": 0.785, + "build/src/800_b.o": 0.072, + "build/src/800_b_2.o": 0.317, + "build/src/800_b_o0a.o": 0.077, + "build/src/800_c.o": 0.206, + "build/src/800b2.o": 0.075, + "build/src/apicard1.o": 0.087, + "build/src/apicard2.o": 0.074, + "build/src/apicard3.o": 0.092, + "build/src/apicard4.o": 0.075, + "build/src/apicard5.o": 0.096, + "build/src/apicard6.o": 0.071, + "build/src/apicard7.o": 0.083, + "build/src/boot.o": 0.113, + "build/src/gap.o": 0.093, + "build/src/libapi1.o": 0.092, + "build/src/libapi2.o": 0.064, + "build/src/libc2_1.o": 0.071, + "build/src/libc2_2.o": 0.063, + "build/src/libcd1.o": 0.081, + "build/src/libcd2.o": 0.07, + "build/src/libetc.o": 0.073, + "build/src/libgpu.o": 0.076, + "build/src/libgpu2.o": 0.088, + "build/src/libgs1.o": 0.066, + "build/src/libgs2.o": 0.066, + "build/src/libgs3.o": 0.063, + "build/src/libgs4.o": 0.066, + "build/src/libgs5.o": 0.063, + "build/src/libgs6.o": 0.088, + "build/src/libgs7.o": 0.072, + "build/src/libgs8.o": 0.063, + "build/src/libgte1.o": 0.061, + "build/src/libgte10.o": 0.06, + "build/src/libgte11.o": 0.067, + "build/src/libgte12.o": 0.062, + "build/src/libgte13.o": 0.066, + "build/src/libgte14.o": 0.068, + "build/src/libgte15.o": 0.061, + "build/src/libgte16.o": 0.064, + "build/src/libgte17.o": 0.064, + "build/src/libgte18.o": 0.065, + "build/src/libgte19.o": 0.065, + "build/src/libgte2.o": 0.063, + "build/src/libgte20.o": 0.063, + "build/src/libgte21.o": 0.071, + "build/src/libgte22.o": 0.068, + "build/src/libgte23.o": 0.057, + "build/src/libgte24.o": 0.069, + "build/src/libgte25.o": 0.062, + "build/src/libgte26.o": 0.071, + "build/src/libgte27.o": 0.068, + "build/src/libgte28.o": 0.071, "build/src/libgte29.o": 0.068, - "build/src/libgte3.o": 0.069, - "build/src/libgte30.o": 0.069, - "build/src/libgte4.o": 0.065, - "build/src/libgte5.o": 0.065, - "build/src/libgte6.o": 0.061, - "build/src/libgte7.o": 0.058, - "build/src/libgte8.o": 0.059, - "build/src/libgte9.o": 0.068, - "build/src/libmcrd1.o": 0.082, + "build/src/libgte3.o": 0.067, + "build/src/libgte30.o": 0.081, + "build/src/libgte4.o": 0.07, + "build/src/libgte5.o": 0.07, + "build/src/libgte6.o": 0.07, + "build/src/libgte7.o": 0.064, + "build/src/libgte8.o": 0.062, + "build/src/libgte9.o": 0.074, + "build/src/libmcrd1.o": 0.088, "build/src/libmcrd2.o": 0.064, - "build/src/libpad1.o": 0.068, - "build/src/libpad2.o": 0.066, - "build/src/sgap.o": 0.066, + "build/src/libpad1.o": 0.076, + "build/src/libpad2.o": 0.078, + "build/src/sgap.o": 0.07, "build/src/sgap_2.o": 0.067, - "build/src/sgap_3.o": 0.073, - "build/src/sgap_4.o": 0.078, - "build/src/sgap_5.o": 0.065, - "build/src/sgap_6.o": 0.064, - "build/src/sgap_8.o": 0.076, - "build/src/snd1.o": 0.073, - "build/src/snd10.o": 0.07, - "build/src/snd11.o": 0.071, - "build/src/snd12.o": 0.063, - "build/src/snd2.o": 0.072, - "build/src/snd3.o": 0.068, + "build/src/sgap_3.o": 0.065, + "build/src/sgap_4.o": 0.076, + "build/src/sgap_5.o": 0.07, + "build/src/sgap_6.o": 0.071, + "build/src/sgap_8.o": 0.081, + "build/src/snd1.o": 0.079, + "build/src/snd10.o": 0.076, + "build/src/snd11.o": 0.076, + "build/src/snd12.o": 0.071, + "build/src/snd2.o": 0.074, + "build/src/snd3.o": 0.071, "build/src/snd4.o": 0.073, - "build/src/snd5.o": 0.067, - "build/src/snd6.o": 0.069, - "build/src/snd7.o": 0.069, - "build/src/snd8.o": 0.063, - "build/src/snd9.o": 0.065, - "build/src/ov_SC03_014/ov_SC03_014.o": 0.141, - "build/src/ov_SC03_014/ov_SC03_014_after.o": 0.509, - "build/src/ov_SC03_014/ov_SC03_014_jr_8012ACE0.o": 0.394, - "build/src/ov_SC03_014/ov_SC03_014_jr_80135888.o": 0.082, - "build/src/ov_SC03_014/ov_SC03_014_jr_80135A4C.o": 0.08, - "build/src/ov_SC03_014/ov_SC03_014_jr_80135D20.o": 0.126, - "build/src/ov_SC03_014/ov_SC03_014_jr_801380E0.o": 0.169, - "build/src/ov_SC03_014/ov_SC03_014_jr_8013C98C.o": 0.129, - "build/src/ov_SC03_014/ov_SC03_014_jr_8013F350.o": 0.097, - "build/src/ov_SC03_014/ov_SC03_014_jr_8013FFD8.o": 0.074, - "build/src/ov_SC03_014/ov_SC03_014_jr_80140608.o": 0.182, - "build/src/ov_SC03_014/ov_SC03_014_jr_8015444C.o": 0.086, - "build/src/ov_SC03_014/ov_SC03_014_jr_80154C24.o": 0.174, - "build/src/ov_SC03_014/ov_SC03_014_jr_801588CC.o": 0.102, - "build/src/ov_SC03_014/ov_SC03_014_jr_80159C84.o": 0.079, - "build/src/ov_SC03_014/ov_SC03_014_jr_8015A3C8.o": 0.075, - "build/src/ov_SC03_014/ov_SC03_014_jr_8015AE2C.o": 0.093, - "build/src/ov_SC03_014/ov_SC03_014_jr_8015C32C.o": 0.487, - "build/src/ov_SC03_014/ov_SC03_014_jr_8016AB6C.o": 0.267, - "build/src/ov_SC03_014/ov_SC03_014_jr_80171B4C.o": 0.102, - "build/src/ov_SC03_014/ov_SC03_014_jr_801734BC.o": 0.205, - "build/src/ov_SC03_014/ov_SC03_014_jr_801789AC.o": 0.064, - "build/src/ov_SC03_014/ov_SC03_014_jr_80178D40.o": 0.099, - "build/src/ov_SC03_014/ov_SC03_014_jr_8017A4AC.o": 0.066, - "build/src/ov_SC03_014/ov_SC03_014_jr_8017AE2C.o": 0.168, - "build/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.o": 0.193, - "build/src/ov_SC03_014/ov_SC03_014_jr_80184440.o": 0.054, - "build/src/ov_SC03_014/ov_SC03_014_jr_801848E4.o": 0.281, - "build/src/ov_SC03_014/ov_SC03_014_o0b.o": 0.059, - "build/src/ov_SC03_014/ov_SC03_014_o0c.o": 0.06, - "build/src/ov_SC03_014/ov_SC03_014_o0d.o": 0.053, - "build/src/ov_SC03_014/ov_SC03_014_o0e.o": 0.065, - "build/src/ov_SC03_015/ov_SC03_015.o": 0.12, - "build/src/ov_SC03_015/ov_SC03_015_after.o": 0.526, - "build/src/ov_SC03_015/ov_SC03_015_jr_8012ACE0.o": 0.382, + "build/src/snd5.o": 0.071, + "build/src/snd6.o": 0.083, + "build/src/snd7.o": 0.072, + "build/src/snd8.o": 0.067, + "build/src/snd9.o": 0.077, + "build/src/ov_SC03_014/ov_SC03_014.o": 0.157, + "build/src/ov_SC03_014/ov_SC03_014_after.o": 0.569, + "build/src/ov_SC03_014/ov_SC03_014_jr_8012ACE0.o": 0.432, + "build/src/ov_SC03_014/ov_SC03_014_jr_80135888.o": 0.086, + "build/src/ov_SC03_014/ov_SC03_014_jr_80135A4C.o": 0.068, + "build/src/ov_SC03_014/ov_SC03_014_jr_80135D20.o": 0.131, + "build/src/ov_SC03_014/ov_SC03_014_jr_801380E0.o": 0.188, + "build/src/ov_SC03_014/ov_SC03_014_jr_8013C98C.o": 0.133, + "build/src/ov_SC03_014/ov_SC03_014_jr_8013F350.o": 0.102, + "build/src/ov_SC03_014/ov_SC03_014_jr_8013FFD8.o": 0.085, + "build/src/ov_SC03_014/ov_SC03_014_jr_80140608.o": 0.213, + "build/src/ov_SC03_014/ov_SC03_014_jr_8015444C.o": 0.098, + "build/src/ov_SC03_014/ov_SC03_014_jr_80154C24.o": 0.197, + "build/src/ov_SC03_014/ov_SC03_014_jr_801588CC.o": 0.112, + "build/src/ov_SC03_014/ov_SC03_014_jr_80159C84.o": 0.105, + "build/src/ov_SC03_014/ov_SC03_014_jr_8015A3C8.o": 0.079, + "build/src/ov_SC03_014/ov_SC03_014_jr_8015AE2C.o": 0.121, + "build/src/ov_SC03_014/ov_SC03_014_jr_8015C32C.o": 0.474, + "build/src/ov_SC03_014/ov_SC03_014_jr_8016AB6C.o": 0.28, + "build/src/ov_SC03_014/ov_SC03_014_jr_80171B4C.o": 0.119, + "build/src/ov_SC03_014/ov_SC03_014_jr_801734BC.o": 0.208, + "build/src/ov_SC03_014/ov_SC03_014_jr_801789AC.o": 0.075, + "build/src/ov_SC03_014/ov_SC03_014_jr_80178D40.o": 0.107, + "build/src/ov_SC03_014/ov_SC03_014_jr_8017A4AC.o": 0.082, + "build/src/ov_SC03_014/ov_SC03_014_jr_8017AE2C.o": 0.179, + "build/src/ov_SC03_014/ov_SC03_014_jr_8017EB7C.o": 0.199, + "build/src/ov_SC03_014/ov_SC03_014_jr_80184440.o": 0.057, + "build/src/ov_SC03_014/ov_SC03_014_jr_801848E4.o": 0.28, + "build/src/ov_SC03_014/ov_SC03_014_o0b.o": 0.064, + "build/src/ov_SC03_014/ov_SC03_014_o0c.o": 0.061, + "build/src/ov_SC03_014/ov_SC03_014_o0d.o": 0.056, + "build/src/ov_SC03_014/ov_SC03_014_o0e.o": 0.069, + "build/src/ov_SC03_015/ov_SC03_015.o": 0.127, + "build/src/ov_SC03_015/ov_SC03_015_after.o": 0.516, + "build/src/ov_SC03_015/ov_SC03_015_jr_8012ACE0.o": 0.388, "build/src/ov_SC03_015/ov_SC03_015_jr_80135888.o": 0.051, - "build/src/ov_SC03_015/ov_SC03_015_jr_80135A4C.o": 0.051, - "build/src/ov_SC03_015/ov_SC03_015_jr_80135D20.o": 0.116, - "build/src/ov_SC03_015/ov_SC03_015_jr_801380E0.o": 0.148, - "build/src/ov_SC03_015/ov_SC03_015_jr_8013C98C.o": 0.113, - "build/src/ov_SC03_015/ov_SC03_015_jr_8013F350.o": 0.064, - "build/src/ov_SC03_015/ov_SC03_015_jr_8013FFD8.o": 0.06, - "build/src/ov_SC03_015/ov_SC03_015_jr_80140608.o": 0.18, - "build/src/ov_SC03_015/ov_SC03_015_jr_8015444C.o": 0.07, - "build/src/ov_SC03_015/ov_SC03_015_jr_80154C24.o": 0.169, + "build/src/ov_SC03_015/ov_SC03_015_jr_80135A4C.o": 0.055, + "build/src/ov_SC03_015/ov_SC03_015_jr_80135D20.o": 0.117, + "build/src/ov_SC03_015/ov_SC03_015_jr_801380E0.o": 0.153, + "build/src/ov_SC03_015/ov_SC03_015_jr_8013C98C.o": 0.118, + "build/src/ov_SC03_015/ov_SC03_015_jr_8013F350.o": 0.074, + "build/src/ov_SC03_015/ov_SC03_015_jr_8013FFD8.o": 0.063, + "build/src/ov_SC03_015/ov_SC03_015_jr_80140608.o": 0.183, + "build/src/ov_SC03_015/ov_SC03_015_jr_8015444C.o": 0.071, + "build/src/ov_SC03_015/ov_SC03_015_jr_80154C24.o": 0.158, "build/src/ov_SC03_015/ov_SC03_015_jr_801588CC.o": 0.085, - "build/src/ov_SC03_015/ov_SC03_015_jr_80159C84.o": 0.066, - "build/src/ov_SC03_015/ov_SC03_015_jr_8015A3C8.o": 0.068, + "build/src/ov_SC03_015/ov_SC03_015_jr_80159C84.o": 0.061, + "build/src/ov_SC03_015/ov_SC03_015_jr_8015A3C8.o": 0.071, "build/src/ov_SC03_015/ov_SC03_015_jr_8015AE2C.o": 0.092, - "build/src/ov_SC03_015/ov_SC03_015_jr_8015C32C.o": 0.472, - "build/src/ov_SC03_015/ov_SC03_015_jr_8016AB6C.o": 0.259, - "build/src/ov_SC03_015/ov_SC03_015_jr_80171B4C.o": 0.101, - "build/src/ov_SC03_015/ov_SC03_015_jr_801734BC.o": 0.201, - "build/src/ov_SC03_015/ov_SC03_015_jr_801789AC.o": 0.058, - "build/src/ov_SC03_015/ov_SC03_015_jr_80178D40.o": 0.1, - "build/src/ov_SC03_015/ov_SC03_015_jr_8017A4AC.o": 0.064, - "build/src/ov_SC03_015/ov_SC03_015_jr_8017AE2C.o": 0.164, - "build/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.o": 0.189, - "build/src/ov_SC03_015/ov_SC03_015_jr_80184440.o": 0.05, - "build/src/ov_SC03_015/ov_SC03_015_jr_801848E4.o": 0.278, + "build/src/ov_SC03_015/ov_SC03_015_jr_8015C32C.o": 0.446, + "build/src/ov_SC03_015/ov_SC03_015_jr_8016AB6C.o": 0.269, + "build/src/ov_SC03_015/ov_SC03_015_jr_80171B4C.o": 0.096, + "build/src/ov_SC03_015/ov_SC03_015_jr_801734BC.o": 0.21, + "build/src/ov_SC03_015/ov_SC03_015_jr_801789AC.o": 0.056, + "build/src/ov_SC03_015/ov_SC03_015_jr_80178D40.o": 0.097, + "build/src/ov_SC03_015/ov_SC03_015_jr_8017A4AC.o": 0.067, + "build/src/ov_SC03_015/ov_SC03_015_jr_8017AE2C.o": 0.165, + "build/src/ov_SC03_015/ov_SC03_015_jr_8017EB7C.o": 0.21, + "build/src/ov_SC03_015/ov_SC03_015_jr_80184440.o": 0.052, + "build/src/ov_SC03_015/ov_SC03_015_jr_801848E4.o": 0.284, "build/src/ov_SC03_015/ov_SC03_015_o0b.o": 0.06, - "build/src/ov_SC03_015/ov_SC03_015_o0c.o": 0.061, - "build/src/ov_SC03_015/ov_SC03_015_o0d.o": 0.054, - "build/src/ov_SC03_015/ov_SC03_015_o0e.o": 0.069, - "build/src/ov_SC04_011/ov_SC04_011.o": 0.121, - "build/src/ov_SC04_011/ov_SC04_011_after.o": 0.423, - "build/src/ov_SC04_011/ov_SC04_011_jr_8012ACE0.o": 0.353, + "build/src/ov_SC03_015/ov_SC03_015_o0c.o": 0.06, + "build/src/ov_SC03_015/ov_SC03_015_o0d.o": 0.05, + "build/src/ov_SC03_015/ov_SC03_015_o0e.o": 0.07, + "build/src/ov_SC04_011/ov_SC04_011.o": 0.12, + "build/src/ov_SC04_011/ov_SC04_011_after.o": 0.428, + "build/src/ov_SC04_011/ov_SC04_011_jr_8012ACE0.o": 0.348, "build/src/ov_SC04_011/ov_SC04_011_jr_80135888.o": 0.054, - "build/src/ov_SC04_011/ov_SC04_011_jr_80135A4C.o": 0.053, - "build/src/ov_SC04_011/ov_SC04_011_jr_80135D20.o": 0.12, - "build/src/ov_SC04_011/ov_SC04_011_jr_801380E0.o": 0.152, - "build/src/ov_SC04_011/ov_SC04_011_jr_8013C98C.o": 0.109, - "build/src/ov_SC04_011/ov_SC04_011_jr_8013F350.o": 0.076, - "build/src/ov_SC04_011/ov_SC04_011_jr_8013FFD8.o": 0.065, - "build/src/ov_SC04_011/ov_SC04_011_jr_80140608.o": 0.172, - "build/src/ov_SC04_011/ov_SC04_011_jr_8015444C.o": 0.072, - "build/src/ov_SC04_011/ov_SC04_011_jr_80154C24.o": 0.169, - "build/src/ov_SC04_011/ov_SC04_011_jr_801588CC.o": 0.092, + "build/src/ov_SC04_011/ov_SC04_011_jr_80135A4C.o": 0.056, + "build/src/ov_SC04_011/ov_SC04_011_jr_80135D20.o": 0.115, + "build/src/ov_SC04_011/ov_SC04_011_jr_801380E0.o": 0.153, + "build/src/ov_SC04_011/ov_SC04_011_jr_8013C98C.o": 0.112, + "build/src/ov_SC04_011/ov_SC04_011_jr_8013F350.o": 0.072, + "build/src/ov_SC04_011/ov_SC04_011_jr_8013FFD8.o": 0.059, + "build/src/ov_SC04_011/ov_SC04_011_jr_80140608.o": 0.18, + "build/src/ov_SC04_011/ov_SC04_011_jr_8015444C.o": 0.073, + "build/src/ov_SC04_011/ov_SC04_011_jr_80154C24.o": 0.162, + "build/src/ov_SC04_011/ov_SC04_011_jr_801588CC.o": 0.087, "build/src/ov_SC04_011/ov_SC04_011_jr_80159C84.o": 0.066, - "build/src/ov_SC04_011/ov_SC04_011_jr_8015A3C8.o": 0.073, - "build/src/ov_SC04_011/ov_SC04_011_jr_8015AE2C.o": 0.093, - "build/src/ov_SC04_011/ov_SC04_011_jr_8015C32C.o": 0.353, - "build/src/ov_SC04_011/ov_SC04_011_jr_8016AB6C.o": 0.217, - "build/src/ov_SC04_011/ov_SC04_011_jr_80171B4C.o": 0.099, - "build/src/ov_SC04_011/ov_SC04_011_jr_801734BC.o": 0.164, - "build/src/ov_SC04_011/ov_SC04_011_jr_801789AC.o": 0.054, - "build/src/ov_SC04_011/ov_SC04_011_jr_80178D40.o": 0.085, - "build/src/ov_SC04_011/ov_SC04_011_jr_8017A4AC.o": 0.063, - "build/src/ov_SC04_011/ov_SC04_011_jr_8017AE2C.o": 0.093, + "build/src/ov_SC04_011/ov_SC04_011_jr_8015A3C8.o": 0.075, + "build/src/ov_SC04_011/ov_SC04_011_jr_8015AE2C.o": 0.096, + "build/src/ov_SC04_011/ov_SC04_011_jr_8015C32C.o": 0.357, + "build/src/ov_SC04_011/ov_SC04_011_jr_8016AB6C.o": 0.222, + "build/src/ov_SC04_011/ov_SC04_011_jr_80171B4C.o": 0.097, + "build/src/ov_SC04_011/ov_SC04_011_jr_801734BC.o": 0.168, + "build/src/ov_SC04_011/ov_SC04_011_jr_801789AC.o": 0.057, + "build/src/ov_SC04_011/ov_SC04_011_jr_80178D40.o": 0.088, + "build/src/ov_SC04_011/ov_SC04_011_jr_8017A4AC.o": 0.06, + "build/src/ov_SC04_011/ov_SC04_011_jr_8017AE2C.o": 0.095, "build/src/ov_SC04_011/ov_SC04_011_jr_8017D494.o": 0.444, - "build/src/ov_SC04_011/ov_SC04_011_o0b.o": 0.048, - "build/src/ov_SC04_011/ov_SC04_011_o0c.o": 0.06 + "build/src/ov_SC04_011/ov_SC04_011_o0b.o": 0.046, + "build/src/ov_SC04_011/ov_SC04_011_o0c.o": 0.053 }, "ok": true, - "seconds": 2.3 + "seconds": 2.4 } diff --git a/config/tool_dictionary.tsv b/config/tool_dictionary.tsv index b53599c053..ea1ba88bdf 100644 --- a/config/tool_dictionary.tsv +++ b/config/tool_dictionary.tsv @@ -69,7 +69,7 @@ tools/decompme_replica.sh P4 ADAPT reproduce an external reference toolchain loc tools/dedup_extend.py P6 ADAPT extend an existing code-share registry to newly onboarded binaries Extends the existing share registry to newly onboarded binaries repo config/src layout SUPERSEDED tools/share_body.py tools/dedup_integrate.py P6 ADAPT validate a code-share registry byte-honestly, failing closed on signature drift Byte-honesty validator for the code-share registry; fails closed on signature drift repo config registry path LIVE tools/dedup_propagate.py P6 ADAPT lift one matched body into a shared macro and instantiate it everywhere Lifts one matched body into a shared macro and instantiates it at every duplicate site repo shared-header/src layout SUPERSEDED tools/share_body.py -tools/delever.py P10 ADAPT take register pins, asm statements, volatile and register levers out of matched C, byte-gated per site The Phase-36 de-lever engine: positional rewrites per lever class (pin -> plain declaration, barrier/launder/keep-alive deleted, a hand-placed instruction -> its C, the zero-register variable -> 0, volatile/register dropped), rung A strip-all and rung B greedy per body through delever_oracle, headers serialized after the TU phase; --probe runs a stratified sample of distinct bodies and prices the campaign with denominators the census site records, the oracle LIVE +tools/delever.py P10 ADAPT take register pins, asm statements, volatile and register levers out of matched C, byte-gated per site The Phase-36 de-lever engine and campaign tool: positional rewrites per lever class (pin -> plain declaration, barrier/keep-alive deleted, a launder deleted or turned into the assignment it is, a hand-placed instruction -> its C, the zero-register variable -> 0, a macro-carried site deleted/valued/refused by its macro's shape, volatile/register dropped); per body replay -> rung A strip-all -> rung B greedy through delever_oracle; the file is the write unit and its final compile through every recipe the proof; --plan/--apply batches (TUs parallel, exemplar files first; headers serial, includers parallel), the ledger keyed by tu+fn+addr with the body's nhash before/after, !FAKE markers on class A/B survivors, --restore from inflight.json, --apply-body for T6/T7, --selftest with a stub oracle, --probe (T2) the census site records, the oracle LIVE tools/delever_oracle.py P10 ADAPT judge one translation-unit edit by the bytes of its object in under a second The Phase-36 fast byte oracle: every object's exact build command captured once via make -n -W (the Makefile's own recipe, pad stage and -O0 overrides included), a candidate compiled in place with -o/-MF redirected to scratch and compared with the fleet run's object; --calibrate proves 100 % equality untouched, twin == primary and a positive control before any verdict is trusted the Makefile's object rules, the twin rule LIVE tools/demacroize.py P6 ADAPT escape a shared-header declaration conflict locally by unmacroizing one body Per-binary local escape from a shared-header declaration conflict by unmacroizing one body repo shared-header layout FROZEN tools/share_body.py tools/diff_autopsy.sh P7 ADAPT find which words diverge when the whole-binary gate says different but not where Reproduces exactly what the gate saw, then decodes the diverging words and restores the tree repo src/build paths STILL-NEEDED find WHICH words diverge when the whole-binary gate says DIFF but not where @@ -281,6 +281,7 @@ tools/seed_ref.py P8 ADAPT find an already-banked body that matches an open stub tools/serve_local.py P8 ADAPT serve a fine-tuned model locally behind a chat-completions endpoint Serves the fine-tuned model locally behind a chat-completions endpoint training venv, GPU assumptions LIVE tools/share_body.py P10 ADAPT share one byte-identical function class across its binaries through an include-at-site header, gated per binary The Phase-35 successor of dedup_propagate + dedup_extend for the include-at-site form: exemplar by majority text, the header written once, every private copy replaced by the include at its position, per-binary byte gate with object comparison, bisect on red, the registry appended or extended by text, the exception ledger on refusal; --plan / --apply --bucket extend|new repo paths, the registry and signature schemas LIVE tools/share_body_cycle.sh P10 ADAPT run the share-body batch cycle unattended: batch, verify by exit code, log, commit, periodic clean fleet check The Phase-35 T5 driver for bucket new: per batch share_body --apply --bucket new --batches 1 --label new, the gated N/N line read, the phase log entry appended, the bank committed the moment it is green, the clean fleet run every N batches — stops on the first red repo paths, the phase-log format, the fleet count from config/check.*.sha LIVE +tools/delever_cycle.sh P10 ADAPT run the de-lever batch cycle unattended: batch, verify by exit code, clean fleet gate, census, log, commit The Phase-36 T3/T4 driver: per batch a clean-tree check, the oracle recalibrated when stale, delever --apply read by exit code and its final X/X line, the clean fleet run as the outer gate (218/218), the census rerun, the phase-log entry and the checkpoint headline, one commit per batch; stops on the first red with the files in place for --restore the batch size, the aliases, the fleet count LIVE tools/share_census.py P10 ADAPT measure duplicate function bodies across the fleet and assert one source per unique function The census of byte-identical function classes across every binary with their source forms and verdicts, plus the S1 invariant check with its exception ledger and a fixture self-test repo paths, the registry and signature schemas LIVE tools/shared_lock.py P8 ADAPT hold one reader/writer lock over the shared source state for concurrent lanes One reader/writer lock over the shared source state for concurrent lanes repo lock paths LIVE tools/sig_image.py P6 PORTABLE sign every function of a flat image at a known base, without a disassembler Disassembler-free per-function signer for a flat image at a known base, field-identical to the dumper MIPS encodings, repo scratch paths LIVE diff --git a/decomp-architect/corpus/tools/INDEX.md b/decomp-architect/corpus/tools/INDEX.md index 8efc4989da..52e8deedf7 100644 --- a/decomp-architect/corpus/tools/INDEX.md +++ b/decomp-architect/corpus/tools/INDEX.md @@ -8,8 +8,8 @@ > its platform SDK need the marked adaptation. The last table lists the tools that are project-only in code (their *shape* is a task; > their code does not transfer). *TODO(platform): the MIPS and PlayStation SDK hard-codes are the ones another platform replaces first.* > -> **Coverage:** 298 tool files in scope (submodules, vendored and downloaded code excluded), of which 298 live rows -> below; per phase: P1 2 · P2 26 · P3 17 · P4 9 · P5 26 · P6 51 · P7 20 · P8 86 · P9 27 · P10 18 · PROJECT-ONLY 16. Superseded tools appear only as pointers to their successor (30 pointer rows); one-offs are omitted. Table rows in all: 328 (the installer checks its copy against this figure). +> **Coverage:** 299 tool files in scope (submodules, vendored and downloaded code excluded), of which 299 live rows +> below; per phase: P1 2 · P2 26 · P3 17 · P4 9 · P5 26 · P6 51 · P7 20 · P8 86 · P9 27 · P10 19 · PROJECT-ONLY 16. Superseded tools appear only as pointers to their successor (30 pointer rows); one-offs are omitted. Table rows in all: 329 (the installer checks its copy against this figure). ## P1 — extraction + manifest @@ -338,9 +338,10 @@ | `ghidra_apply_symbols.sh` | mirror the curated symbol file into the analysis database with a real save | Mirrors the curated symbol file into the analysis program headlessly, with a real save | repo symbol path, project name | | `frozen.py` | refuse, from one place, the command line of a tool the project has frozen | The one refusal a FROZEN tool prints from its main(): the tool, the successor and why; imports never exit (libraries stay usable) | nothing | | `verbatim_target_s.py` | regenerate a splitter-format target disassembly for a function no longer stubbed | Regenerates a splitter-format target disassembly for a function that is no longer a stub; --gas emits the assemblable gas-syntax form ($-registers, .L labels, noreorder) that a web diff service accepts as a pasted target | repo build/asm layout | +| `delever_cycle.sh` | run the de-lever batch cycle unattended: batch, verify by exit code, clean fleet gate, census, log, commit | The Phase-36 T3/T4 driver: per batch a clean-tree check, the oracle recalibrated when stale, delever --apply read by exit code and its final X/X line, the clean fleet run as the outer gate (218/218), the census rerun, the phase-log entry and the checkpoint headline, one commit per batch; stops on the first red with the files in place for --restore | the batch size, the aliases, the fleet count | | `share_body_cycle.sh` | run the share-body batch cycle unattended: batch, verify by exit code, log, commit, periodic clean fleet check | The Phase-35 T5 driver for bucket new: per batch share_body --apply --bucket new --batches 1 --label new, the gated N/N line read, the phase log entry appended, the bank committed the moment it is green, the clean fleet run every N batches — stops on the first red | repo paths, the phase-log format, the fleet count from config/check.*.sha | | `share_body.py` | share one byte-identical function class across its binaries through an include-at-site header, gated per binary | The Phase-35 successor of dedup_propagate + dedup_extend for the include-at-site form: exemplar by majority text, the header written once, every private copy replaced by the include at its position, per-binary byte gate with object comparison, bisect on red, the registry appended or extended by text, the exception ledger on refusal; --plan / --apply --bucket extend|new | repo paths, the registry and signature schemas | -| `delever.py` | take register pins, asm statements, volatile and register levers out of matched C, byte-gated per site | The Phase-36 de-lever engine: positional rewrites per lever class (pin -> plain declaration, barrier/launder/keep-alive deleted, a hand-placed instruction -> its C, the zero-register variable -> 0, volatile/register dropped), rung A strip-all and rung B greedy per body through delever_oracle, headers serialized after the TU phase; --probe runs a stratified sample of distinct bodies and prices the campaign with denominators | the census site records, the oracle | +| `delever.py` | take register pins, asm statements, volatile and register levers out of matched C, byte-gated per site | The Phase-36 de-lever engine and campaign tool: positional rewrites per lever class (pin -> plain declaration, barrier/keep-alive deleted, a launder deleted or turned into the assignment it is, a hand-placed instruction -> its C, the zero-register variable -> 0, a macro-carried site deleted/valued/refused by its macro's shape, volatile/register dropped); per body replay -> rung A strip-all -> rung B greedy through delever_oracle; the file is the write unit and its final compile through every recipe the proof; --plan/--apply batches (TUs parallel, exemplar files first; headers serial, includers parallel), the ledger keyed by tu+fn+addr with the body's nhash before/after, !FAKE markers on class A/B survivors, --restore from inflight.json, --apply-body for T6/T7, --selftest with a stub oracle, --probe (T2) | the census site records, the oracle | | `verbatim_to_stub.py` | turn an inline-assembly body back into a stub the toolchain can reach | Turns an inline-assembly body back into an include-assembly stub | repo src/asm layout | ## PROJECT-ONLY — project-only in code (the shape is a task; the code does not transfer) diff --git a/decomp-architect/corpus/tools/P10/delever.py b/decomp-architect/corpus/tools/P10/delever.py index 22b8de665b..b763aee5b2 100644 --- a/decomp-architect/corpus/tools/P10/delever.py +++ b/decomp-architect/corpus/tools/P10/delever.py @@ -1,32 +1,62 @@ #!/usr/bin/env python3 """delever.py — take the compiler-forcing constructs ("levers") out of matched C, byte-gated per translation unit -(Phase 36; the probe engine at T2, the campaign tool at T3). +(Phase 36: the probe engine at T2, the campaign tool at T3). - tools/delever.py --probe --sample 150 [--seed 1] [-j 12] # T2: rung A + rung B on a stratified sample of DISTINCT bodies - # -> .run/P36/probe/{probe_results.jsonl,probe_summary.json,probe_table.md} + tools/delever.py --plan [--batch 300] [--headers] [--only X ...] # what the next batch would do (no writes) + tools/delever.py --apply --batch 300 --label tu1 [--headers] [--only X ...] [-j 12] + # judge every drawable body of the batch's files, KEEP the winning + # text in place, mark the survivors `// !FAKE:`, ledger every site + tools/delever.py --restore # every in-flight file back from inflight.json (never git checkout, R102) + tools/delever.py --status # the ledger's totals + tools/delever.py --apply-body TU FN FILE --label w1 [--rung E] # T6/T7: a reshaped function judged on the bytes and kept + tools/delever.py --selftest # the fixture: every site kind, the decoys, a stub oracle + tools/delever.py --probe --sample 150 [--seed 1] [-j 12] # T2's measurement (unchanged) THE LADDER PER BODY (deterministic, zero tokens): - rung A strip-all — every removable site of the body rewritten at once (pin -> plain declaration; barrier/launder/keep-alive -> - deleted; a hand-placed instruction -> its C; `$0` pin -> its variable's uses replaced by 0; volatile -> dropped; register -> - dropped), one compile, the object compared with the fleet run's (tools/delever_oracle.py). Measured twice: with the `register` - keyword dropped from the pin (the target form) and with it kept (A'). + replay a body whose normalized text (`nhash`, func_/D_ addresses masked) matches a body the ledger already judged replays that + body's accepted edit set: one compile. A disagreement falls through to the full ladder and is recorded. + rung A strip-all — every removable site of the body rewritten at once, one compile, the object compared with the fleet run's + (tools/delever_oracle.py). rung B greedy — if A differs: from the untouched text, the sites are re-applied one at a time (asm statements first, then pins, - volatile, register); a site whose removal keeps the object identical is REMOVED, one that changes it is NEEDED. -The verdict of a body = the set of NEEDED sites; a body with none is lever-free. Never touched: GTE ops, the manifest's verbatim -bodies, an asm-body (a whole routine — the manifest's DECOMPILE rows are another task's work), file-scope declarations. + volatile, register); a site whose removal keeps the object identical is REMOVED, one that changes it is NEEDED — with the + oracle's word (DIFFERS / COMPILE-ERROR / COMPILE-CRASH) as the reason. +The verdict of a body = the set of NEEDED sites; a body with none is lever-free. -EVERY EDIT IS POSITIONAL on the raw text (line/col from the census), the file is written in place for the compile and restored -from the in-memory snapshot right after (never `git checkout`, R102); a site whose raw token does not match the census is REFUSED -(R43), never guessed. +THE REWRITE PER SITE (positional on the RAW text at the census's line/col; a token that is not what the census saw is REFUSED, R43): + pin `register T x __asm__("$N") [= e];` -> `T x [= e];` (the `$0` zero-register variable: the declaration deleted, every use -> 0; + a variable that is ever assigned is REFUSED) + barrier `__asm__("" ::: "memory");`, keep-alive `__asm__("" : : "r"(x));`, launder `__asm__("" : "=r"(x) : "0"(x));` -> deleted + launder whose output and input DIFFER `__asm__("" : "=r"(p) : "0"(&D_x));` -> the assignment it is: `p = &D_x;` + (deleting it leaves `p` undefined — cc1 2.7.2 ABORTS on such a candidate; the T2 probe counted those as NEEDED) + a hand-placed instruction (`addu %0,%1,$zero` / move / la / lh / lw / addiu / sll / …) -> its C statement, or REFUSED (no spelling) + a macro-carried site: `SHB(x);` (a pure launder statement macro) -> deleted; `LAUNDER(p)` (a launder statement-expression) -> its + value `((T)(p))`; a COMPOUND macro (XFER, DRAW, RTP_SND, …: real code around the asm) -> REFUSED, the lever is in the #define (T5) + volatile (a cast, a body declaration, a parameter, a file-scope declaration) -> the qualifier dropped; bare `register` -> dropped + GTE ops, the manifest's verbatim bodies: never touched. An asm-body (a whole routine in a C shell) is DEFERRED to T7 and marked. + +THE FILE IS THE WRITE UNIT, ITS FINAL COMPILE THE PROOF: every body's candidates are judged against the file's ORIGINAL text; the +accepted edits of every body, the file-scope edits and the `// !FAKE:` markers are spliced once at the end, and that final text is +compiled through EVERY recipe of the file (a twin's object too; every includer of a header, in parallel) — IDENTICAL or the file-scope +edits are dropped and it is compiled again, or the file is restored and REFUSED (COMBINATION-FAILED, loud). The batch's touched files +are left in place for the outer gate (the clean fleet run, R22, in tools/delever_cycle.sh); every file's original text is in +.run/P36/delever/inflight.json before the first write, and --restore reads it. + +"DONE" IS A LEDGER FACT KEYED BY TEXT: every ledger row records the body's nhash BEFORE and AFTER. A body whose current nhash is some +row's after-hash is done (drawn again only with --rejudge); one whose current nhash is some row's before-hash replays it. Markers are +comments and do not change the hash; a reshaped body (T6/T7) gets a new hash and is drawn again. Class C/D survivors are never marked +(Drew's decision 3) — the ledger is their record; class A/B survivors carry `// !FAKE: — (P36