Skip to content

monobj: opus2 dive - #17662

Merged
zcanann merged 4 commits into
mainfrom
pr/monobj-opus2-1781462565
Jun 15, 2026
Merged

monobj: opus2 dive#17662
zcanann merged 4 commits into
mainfrom
pr/monobj-opus2-1781462565

Conversation

@AsclepiusBot

Copy link
Copy Markdown
Collaborator

Second Opus pass on monobj.cpp. Unit 97.867 -> 97.940 (+0.073).

Landed

  • statWatch 96.725 -> 96.905: unified the Pass-2 result accumulator into selectedTarget, dropping a register-bounce (mr) and a redundant selectedTarget=-1 init — the target reuses one register for both.
  • setRepop 96.920 -> 97.939 (two commits):
    • widened countC from short to int — the u16 weapon-mode particle count was sign-extended (extsh) while the target zero-extends (clrlwi) and compares directly.
    • rewrote the classId particle-base dispatch as an explicit >= 0xA9 -> pbDone else pbSet2 chain, emitting the target's bge branch and matching block layout.
  • mlAttackCheck 96.493 -> 96.702: cached the volatile groupCursor once into a local in the wloop body (keeping the volatile store + post-store >=8 re-read), matching the target's single-load pattern and removing an extra lwz reload.

Walls confirmed (no source steer found)

  • setActionParam: m_scriptHandle partial de-cache (all reload forms regress 94 -> 77/84).
  • statAround / onDrawDebug: base + var*scale + const addressing — target folds the const as a displacement (lfs/lhz disp(rX)), ours emits indexed (lhzx); not source-steerable.
  • moveAStar / checkCol: pure emergent FPR coloring (f27/f29/f30/f31 permutations); decl reorder regresses.
  • statAround / mlAttackCheck: AISCRIPT macro re-expansion register-bounce (mr) — emergent coloring.
  • onChangeStat: &&-chain block layout (bge;b;b vs blt) and script de-cache.
  • isValidTarget: target keeps script9 in a reg via local CSE; caching it as a real local cascades to a callee-saved home (86.66 catastrophe).

🤖 Generated with Claude Code

claude added 4 commits June 14, 2026 11:48
Merging the Pass-2 result accumulator into selectedTarget eliminates a
register-bounce (mr r27,r23) and a separate selectedTarget=-1 init, matching
the target which reuses the same register for result and selectedTarget.
statWatch 96.725->96.905, unit 97.867->97.880.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The weapon-mode particle count is read from u16 script fields; holding it
in a signed short forced extsh + cast, while the target zero-extends (clrlwi)
and compares directly. int countC drops the cast and matches the loop bound.
setRepop 96.920->97.897, unit 97.880->97.925.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rewriting the classId dispatch as an explicit (>= 0xA9 -> pbDone) else
(pbSet2) chain emits the target's bge branch instead of our blt, matching
block layout. setRepop 97.897->97.939, unit 97.925->97.927.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The volatile groupCursor was re-read between the groupCount[] index and the
increment; reading it once into a local wcursor (keeping the volatile store
and the post-store >=8 re-read) matches the target's single-load pattern.
mlAttackCheck 96.493->96.702, unit 97.927->97.940.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@decomp-dev

decomp-dev Bot commented Jun 14, 2026

Copy link
Copy Markdown

Report for GCCP01 (5c88a85 - f030f7a)

📈 3 improvements in unmatched items
Unit Item Bytes Before After
main/monobj CGMonObj::setRepop(int) +14 96.95% 97.94%
main/monobj CGMonObj::statWatch() +4 96.73% 96.91%
main/monobj CGMonObj::mlAttackCheck(int) +4 96.49% 96.70%
📉 1 regression in an unmatched item
Unit Item Bytes Before After
main/monobj extabindex -34 96.67% 90.37%

@zcanann
zcanann merged commit 5d8507c into main Jun 15, 2026
2 checks passed
@zcanann
zcanann deleted the pr/monobj-opus2-1781462565 branch June 15, 2026 00:50
@AsclepiusBot
AsclepiusBot restored the pr/monobj-opus2-1781462565 branch June 24, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants