Improve CHANSVm blob copy/pad allocation (+0.022456 fuzzy) #1150

Merged
coah80 merged 1 commits from agent/chans-blob-copy-padded-20261004 into main 2026-10-04 02:39:40 +00:00
coah80 commented 2026-10-04 02:39:04 +00:00 (Migrated from github.com)

Change

Extract exactly the existing validated blob copy/pad statements into a real inline helper. Preserve both volatile offset reads, overlap-safe memmove, conditional zero-fill and fresh post-copy destination-offset update. Source and destination headers may coincide; const adds no restrict/disjointness promise. Allocation/conversion/parser/error/callback boundaries stay outside the helper in their original order.

This is an independently reconstructed hypothesis, not recovered historical source. The a5h score motivated it, but all evidence below was freshly generated.

Independent verification on 4508f455db

  • VmBlobPackCommon: 97.949104 -> 97.97156; unit99.45986 ->99.46098
  • 668 instructions /2672 bytes unchanged; target differences244 ->242. Partial fuzzy gain, not exact/new linking
  • Only CHANSVm changes among1027 objects/reports; all232 sibling bodies/scores and all224 exact functions preserved. Parent independently disassembled all224 exact functions with zero differences
  • Matched code39908/53564, data6904/6904 and link measures unchanged
  • 49 changed instructions are register allocation only; same CFG/opcodes/immediates/stack offsets/call relocations
  • 79 concrete compiler-local object-name replacements exactly reconstruct .strtab. All raw symbol entries, relocation sections and other nontext sections are byte-identical; no helper body emitted
  • Relational must-equality checks944 uses per baseline/candidate and baseline/target comparison, intersecting corresponding predecessor edges through branches/loops. Explicit GPR and CA/CR0/CTR/LR/memory/save-restore effects covered. Ordinary calls kill undocumented scratch equality and retain only documented results/coupled memory contracts; aligned64-bit ABI arguments explicitly checked
  • Fresh bounded actual copy/pad slice:5456 cases x3=16368 complete-memory/ordered-trace comparisons, including136 same-header,2352 padding,1508 zero-copy,395 forward-overlap and429 backward-overlap cases
  • Direct original-DOL 23-instruction slice verified;603 nonrelocated function words checked. Negative controls reject missing volatile reload, unsafe forward-copy overlap and undocumented scratch use
  • Limits: bounded custom checker/modelled libc and fixed callee contracts, not general formal verification or complete VM/Wii runtime. Malformed header-overwriting payload pointers excluded
  • Default43U, explicit ok, DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, pool125/125 and literal audit233 functions/40 arguments/no skips pass

Three actual worker compiles (baseline/candidate/selected). Parent independently rebuilt and replayed the exact included standalone verifier. Verifier SHA256 80eaf647c3935200f5b52d268de974417c4949184a1593cc1e9ee373a0e6f80a; object a60ea527623793184e6e3edd0584e0e335c534248a5a9902dfe217cefdf39999; tested treebc1e7bd16c405190f40df66d057fa88e17bfb153.

Includes attempt log and argument-driven verifier. Harness-development failures/corrections are documented; no extra source forms were tested. No original binaries/DOL uploaded. Draft for human review; no merge or auto-merge requested.

Note

Extract VmBlobCopyPadded helper in CHANSVm and add semantic verifier

  • Adds a static inline VmBlobCopyPadded helper in CHANSVm.c that copies the remaining source payload up to the requested size, zero-fills unused bytes, and advances the parent blob offset. VmBlobPackCommon now calls this helper instead of its inline copy block; space validation and error paths are unchanged.
  • Adds verify_vm_blob_copy_padded.py, a verifier that decodes the VmBlobPackCommon instructions from the built object, runs reaching-definition and CFG analyses, compares against the original DOL, and executes the copy slice against an independent reference model covering overlap, padding, and offset behavior. It writes a semantic-proof.json report only when all checks pass.
  • Adds a candidate report at CHANSVm.blob-copy-padded-attempts.md documenting the measured differences and verification steps.

Macroscope summarized fb7d42f.

## Change Extract exactly the existing validated blob copy/pad statements into a real inline helper. Preserve both volatile offset reads, overlap-safe memmove, conditional zero-fill and fresh post-copy destination-offset update. Source and destination headers may coincide; const adds no restrict/disjointness promise. Allocation/conversion/parser/error/callback boundaries stay outside the helper in their original order. This is an independently reconstructed hypothesis, not recovered historical source. The a5h score motivated it, but all evidence below was freshly generated. ## Independent verification on 4508f455dbd44de4f512618e91692a9b6115d6e8 - VmBlobPackCommon: 97.949104 -> 97.97156; unit99.45986 ->99.46098 - 668 instructions /2672 bytes unchanged; target differences244 ->242. Partial fuzzy gain, not exact/new linking - Only CHANSVm changes among1027 objects/reports; all232 sibling bodies/scores and all224 exact functions preserved. Parent independently disassembled all224 exact functions with zero differences - Matched code39908/53564, data6904/6904 and link measures unchanged - 49 changed instructions are register allocation only; same CFG/opcodes/immediates/stack offsets/call relocations - 79 concrete compiler-local object-name replacements exactly reconstruct .strtab. All raw symbol entries, relocation sections and other nontext sections are byte-identical; no helper body emitted - Relational must-equality checks944 uses per baseline/candidate and baseline/target comparison, intersecting corresponding predecessor edges through branches/loops. Explicit GPR and CA/CR0/CTR/LR/memory/save-restore effects covered. Ordinary calls kill undocumented scratch equality and retain only documented results/coupled memory contracts; aligned64-bit ABI arguments explicitly checked - Fresh bounded actual copy/pad slice:5456 cases x3=16368 complete-memory/ordered-trace comparisons, including136 same-header,2352 padding,1508 zero-copy,395 forward-overlap and429 backward-overlap cases - Direct original-DOL 23-instruction slice verified;603 nonrelocated function words checked. Negative controls reject missing volatile reload, unsafe forward-copy overlap and undocumented scratch use - Limits: bounded custom checker/modelled libc and fixed callee contracts, not general formal verification or complete VM/Wii runtime. Malformed header-overwriting payload pointers excluded - Default43U, explicit ok, DOL SHA1 26116613f624061ba99c8d1a299aaa6efa85670d, pool125/125 and literal audit233 functions/40 arguments/no skips pass Three actual worker compiles (baseline/candidate/selected). Parent independently rebuilt and replayed the exact included standalone verifier. Verifier SHA256 80eaf647c3935200f5b52d268de974417c4949184a1593cc1e9ee373a0e6f80a; object a60ea527623793184e6e3edd0584e0e335c534248a5a9902dfe217cefdf39999; tested treebc1e7bd16c405190f40df66d057fa88e17bfb153. Includes attempt log and argument-driven verifier. Harness-development failures/corrections are documented; no extra source forms were tested. No original binaries/DOL uploaded. Draft for human review; no merge or auto-merge requested. <!-- Macroscope's pull request summary starts here --> <!-- Macroscope will only edit the content between these invisible markers, and the markers themselves will not be visible in the GitHub rendered markdown. --> <!-- If you delete either of the start / end markers from your PR's description, Macroscope will append its summary at the bottom of the description. --> > [!NOTE] > ### Extract `VmBlobCopyPadded` helper in `CHANSVm` and add semantic verifier > - Adds a static inline `VmBlobCopyPadded` helper in [CHANSVm.c](https://github.com/coah80/wii-ipl/pull/1150/files#diff-fcd94241dcc82f12e50e6a224211f94b32d8c83c08ab0880c20261cea99b4f75) that copies the remaining source payload up to the requested size, zero-fills unused bytes, and advances the parent blob offset. `VmBlobPackCommon` now calls this helper instead of its inline copy block; space validation and error paths are unchanged. > - Adds [verify_vm_blob_copy_padded.py](https://github.com/coah80/wii-ipl/pull/1150/files#diff-24fb01ac5a5b304cd67d6f234b2e701e782d853aa8d47fb9ac8ab72ed2d451d3), a verifier that decodes the `VmBlobPackCommon` instructions from the built object, runs reaching-definition and CFG analyses, compares against the original DOL, and executes the copy slice against an independent reference model covering overlap, padding, and offset behavior. It writes a `semantic-proof.json` report only when all checks pass. > - Adds a candidate report at [CHANSVm.blob-copy-padded-attempts.md](https://github.com/coah80/wii-ipl/pull/1150/files#diff-0e999ee2158970fd0c400e62d6b9df3ce0c4feeb7bfecd8c36a992a1d61847f9) documenting the measured differences and verification steps. > > <!-- Macroscope's review summary starts here --> > > <sup><a href="https://app.macroscope.com">Macroscope</a> summarized fb7d42f.</sup> > <!-- Macroscope's review summary ends here --> > <!-- Macroscope's pull request summary ends here -->
coah80 commented 2026-10-04 02:39:38 +00:00 (Migrated from github.com)

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.

Reviewed and merged: rebased on main, full build ok, DOL sha1 26116613f624061ba99c8d1a299aaa6efa85670d, 0 regressions, 0 forbidden patterns.
Sign in to join this conversation.