refactor(core): name the IPL2-exit GPR indices (missed in #175) - #176
Conversation
The named-constant change I reported as adopted on #175 never landed. The script that applied it hit an assertion on a later, unrelated substitution and exited before writing the file, so none of its earlier edits were saved either. A separate edit fixed the exclusion table by hand, which made the diff look like the whole batch had applied. The seeds now use GPR_AT, GPR_A2, GPR_A3, GPR_T0, GPR_T2, GPR_T3, GPR_S4 and GPR_RA alongside the existing GPR_SP. GPR_T3 carries its own doc comment naming what it is for, since it is the register that decides whether CIC-6105 boots. No behaviour change: the indices are identical, and the R-23 seed test asserts the resulting register values either way. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe HLE boot seeding path replaces hard-coded register indices with ABI-named constants exported from a new ChangesHLE boot register seeding
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 9 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (9 passed)
Comment |
Review follow-up on #176. The constants were module-private to boot.rs, which invites a second private copy elsewhere - and a second copy is how $t3 and $t4 eventually swap in one of them. They now live in rustyn64_cpu::regs::gpr, beside the register file they index. Naming the existing s3-s7 block through the same vocabulary exposed a real duplicate: my S4 seed wrote r20 = 1, and the s3-s7 block three lines later wrote r20 = 1 again as tv_type. Same register, same value, two writes, no second source of truth. The duplicate is removed and the reason it is absent is stated, so it does not get "helpfully" restored. Oracle: n64-systemtest unchanged at 90 suite-wide, Phase 1 categories Failed: 0 - measured, not assumed, though this change emits identical register writes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Adjudicating all three findings. CodeRabbit — Oracle Number Is Stated. ADOPTED, and measured rather than waived. I could have argued a rename cannot move the oracle, but the rule exists precisely because "obviously cannot" is how a number goes unchecked. Ran it: 90 failing suite-wide, Phase 1 categories Antigravity — define the GPR constants centrally. ADOPTED. That change immediately paid for itself. Naming the existing Antigravity nitpick — repeated Capstone re-run after the move: 5 of 5 folders exercised, including a CIC-6105 title. |
Antigravity review (Gemini via Ultra)This PR replaces hardcoded numeric MIPS general-purpose register (GPR) indices in the HLE boot seeding logic with named constants defined in a new Blocking issuesNone found. Suggestions
Nitpicks
Automated first-pass review by |
|
The remaining Oracle Number Is Stated warning is stale: CodeRabbit last reviewed at
anchored against |
Correcting a claim I made on #175
I replied to Antigravity's magic-number suggestion saying it was adopted. It
was not. The script that applied it hit an assertion on a later, unrelated
substitution and exited before writing the file — so none of its earlier edits
were saved either. A separate hand-edit fixed the exclusion table, which made the
resulting diff look like the whole batch had applied.
Caught by grepping
mainforGPR_T3after the merge and getting0.Oracle number
n64-systemtest: 90 failing suite-wide, Phase 1 categories
Failed: 0—unchanged. Measured, not waived: a rename "obviously cannot" move the oracle,
and "obviously cannot" is how a number goes unchecked.
Also re-ran the local commercial capstone: 5 of 5 folders exercised, including a
CIC-6105 title.
Changes
rustyn64_cpu::regs::gpr, beside theregister file they index, rather than staying module-private to
boot.rs. Asecond private copy elsewhere is how
$t3and$t4eventually swap in one ofthem (Antigravity's point, and it is right).
s3–s7block is named through the same vocabulary, so no bareregister indices remain in
hle_boot.What that surfaced
Naming the
s3–s7block exposed a duplicate I had introduced and notnoticed: my
gpr::S4seed wroter20 = 1, and thes3–s7block three lineslater wrote
r20 = 1again astv_type. Same register, same value, two writes,no second source of truth. Removed, with the reason it is absent stated inline so
it does not get "helpfully" restored.
That is the argument for the rename in miniature: with bare indices,
write(20, 1)twelve lines apart reads as two unrelated statements.No behaviour change
Identical register writes. The R-23 seed test asserts the resulting register
values, so it passes either way — which is also why the original omission was
invisible: nothing failed, because nothing was wrong, only unclear.
Gates
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace,RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps— each run separately, exit status checked, no pipes. Plus#[ignore]dn64-systemtest and the commercial capstones.
🤖 Generated with Claude Code