refactor(mir2): split Z80 codegen into thematic files (C1, pure move) - #63
Merged
Merged
Conversation
Move whole top-level declarations into focused files for arithmetic, comparisons, calls, copies, moves, terminators, patterns and peepholes. Keep the instruction dispatcher intact in its own file. Verify all 154 declarations and comments with go/parser and go/printer. Compare both compilers across 979 tracked frontend sources: 499 identical assembly outputs and 480 identical failures. All required gates pass. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo
PR tests: 🟢 passCommit:
The external CZECH and full Zork I stories are not part of this PR gate. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C1: split
pkg/mir2/z80codegen.gointo thematic files (pure move)Why. Nearly every production fix touches this one ~9.3k-line file, so parallel work had to merge one change at a time. This is a pure move inside package
mir2, with zero logic change.Result: 11 files, the largest 1,166 lines
z80codegen.go_alu.go_call.go_cmp.go_copy.go_inst.go_move.go_muldiv.go_patterns.go_peephole.go_term.goProof
go/parser+go/printercomparison against origin/main shows identical multisets on every axis: 154 top-level declarations including doc and body comments, 2,026 comment texts, the import union, and 201 selector uses. Re-run independently by the manager against a fresh archive of origin/main: all true.--asserts noneandSOURCE_DATE_EPOCH=0. Results: 499 byte-identical.a80, 480 identical failures, 0 mismatches. An independent manager sample of 183 files also gave 0 differences.go vet ./pkg/mir2andgofmt -lare clean, and the mir2/hir/pipeline/c89/nanz gates are green.No critic round: the change is mechanical and its correctness is established by the two independent identity proofs above.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Wrwo36SzxKRZYTgpDo7hzo