tooling: add call chains, skipped calls and unexported callees to the CPU fuzz test #1129

Manually merged
github merged 4 commits from gh-pr/1129/head into gh-pr/1129/base 2026-11-26 22:43:56 +00:00
Owner

@⁠tedin7 on GitHub · 2026-11-24 01:34 UTC · original
tedin7:x2w-fuzz-cpu-calls → main · +233 −6 · 3 files · 4 commits · merged 2026-11-24 03:34 UTC

Change

Follow-up to #1164 (Refs #446). Rebased onto the merged baseline; only what cpu_aot_fuzz_calls does not cover is kept, as a separate --area chains in tools/fuzz_cpu.py. It reuses the baseline's Function, NONVOLATILE and part helpers, its check and report path and its per-area mutant table.

  • A pool of 7 callees that no export names (leaf mixes, a branch, an AL-only return, a store through R8, a 32-bit result, two framed callees that call lower ones), so chains nest two levels deep.
  • 16 exports: call chains of 2 to 4 calls, calls skipped behind a TEST and JZ, and tail jumps (plain, after POP, two arms) including to framed callees.
  • cpu_aot_fuzz_chains in CMakeLists.txt: native, default-translated and /O2-translated exports, 10,016 comparisons at seed 0xCA11.
  • Distinct negative control: --mutant passes RDX before RCX at every direct call and tail jump (the baseline plants a retargeted call). The test fails unless that build differs from native.
  • docs/experiments.md: one new paragraph; one sentence in the baseline paragraph points to it.

AI-assisted. Fixtures are generated from the seed; nothing is copied from elsewhere.

Verification

  • Not run: ctest --preset dev -R '^cpu_aot_fuzz_chains$' on Windows with MSVC (no Windows machine). CI is the first MSVC run.
  • Linux: llvm-ml-19, lld-link-19, MinGW g++ (-O0 and -O2) and Wine against the native DLL, on this merge commit: chains total=5008 bad=0 for each build; mutant bad=3711 of 5008 in 13 of 16 functions. The baseline calls area at the same commit is unchanged: bad=0, mutant 313 of 7825.
  • Negative control on origin/main: python3 -B tools/fuzz_cpu.py emit 0xCA11 16 a b --area chains fails with invalid choice: 'chains'; with this change it succeeds.
  • python3 -B tests/docs_links_check.py: 15 files, 263 links. docs/experiments.md grows by 2 lines (one paragraph).

Evidence and follow-up

Assumption: MinGW and Wine exercise the same translated C++, not MSVC code generation. Recursion, indirect calls, dead reads, fault equivalence and RBP frames remain follow-ups.

Checklist

  • This pull request covers one reviewable behavior.
  • I included the exact command and result for every check I ran.
  • I considered a negative control or failure case for a new fixture.
  • I updated README/docs when a capability or build requirement changed.
  • I did not include game files, dumps, distribution links or secrets.
**@⁠tedin7** on GitHub · 2026-11-24 01:34 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129) `tedin7:x2w-fuzz-cpu-calls` → `main` · +233 −6 · 3 files · 4 commits · merged 2026-11-24 03:34 UTC ## Change Follow-up to #1164 (Refs #446). Rebased onto the merged baseline; only what `cpu_aot_fuzz_calls` does not cover is kept, as a separate `--area chains` in `tools/fuzz_cpu.py`. It reuses the baseline's `Function`, `NONVOLATILE` and `part` helpers, its check and report path and its per-area mutant table. - A pool of 7 callees that no export names (leaf mixes, a branch, an AL-only return, a store through R8, a 32-bit result, two framed callees that call lower ones), so chains nest two levels deep. - 16 exports: call chains of 2 to 4 calls, calls skipped behind a TEST and JZ, and tail jumps (plain, after `POP`, two arms) including to framed callees. - `cpu_aot_fuzz_chains` in `CMakeLists.txt`: native, default-translated and `/O2`-translated exports, 10,016 comparisons at seed `0xCA11`. - Distinct negative control: `--mutant` passes RDX before RCX at every direct call and tail jump (the baseline plants a retargeted call). The test fails unless that build differs from native. - `docs/experiments.md`: one new paragraph; one sentence in the baseline paragraph points to it. AI-assisted. Fixtures are generated from the seed; nothing is copied from elsewhere. ## Verification - Not run: `ctest --preset dev -R '^cpu_aot_fuzz_chains$'` on Windows with MSVC (no Windows machine). CI is the first MSVC run. - Linux: `llvm-ml-19`, `lld-link-19`, MinGW g++ (-O0 and -O2) and Wine against the native DLL, on this merge commit: chains total=5008 bad=0 for each build; mutant bad=3711 of 5008 in 13 of 16 functions. The baseline `calls` area at the same commit is unchanged: bad=0, mutant 313 of 7825. - Negative control on origin/main: `python3 -B tools/fuzz_cpu.py emit 0xCA11 16 a b --area chains` fails with `invalid choice: 'chains'`; with this change it succeeds. - `python3 -B tests/docs_links_check.py`: 15 files, 263 links. `docs/experiments.md` grows by 2 lines (one paragraph). ## Evidence and follow-up Assumption: MinGW and Wine exercise the same translated C++, not MSVC code generation. Recursion, indirect calls, dead reads, fault equivalence and RBP frames remain follow-ups. ## Checklist - [x] This pull request covers one reviewable behavior. - [x] I included the exact command and result for every check I ran. - [x] I considered a negative control or failure case for a new fixture. - [x] I updated README/docs when a capability or build requirement changed. - [x] I did not include game files, dumps, distribution links or secrets.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:43:55 +00:00
github manually merged commit a5e9ae5f57 into gh-pr/1129/base 2026-11-26 22:43:56 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 02:15 UTC · original

P2 Badge Restore the calls command without duplicating the document tail

Following the new reproduction instructions leaves the shell with an unterminated quote: the command stops at -R '^cpu_aot_fuzz_calls rather than providing the complete regex argument (ctest --help documents -R <regex> as “Run tests matching regular expression”). The -V fragment appears at line 7025, after an accidental 4,920-line copy of the remaining experiment notes, which then repeat starting at line 7028. Remove the extra copy and restore ctest --preset dev --no-tests=error -R '^cpu_aot_fuzz_calls$' -V so contributors can reproduce the new experiment without navigating duplicated documentation.

AGENTS.md reference: AGENTS.md:L153-L156

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#discussion_r4674655394) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Restore the calls command without duplicating the document tail** Following the new reproduction instructions leaves the shell with an unterminated quote: the command stops at `-R '^cpu_aot_fuzz_calls ` rather than providing the complete regex argument (`ctest --help` documents `-R <regex>` as “Run tests matching regular expression”). The `-V` fragment appears at line 7025, after an accidental 4,920-line copy of the remaining experiment notes, which then repeat starting at line 7028. Remove the extra copy and restore `ctest --preset dev --no-tests=error -R '^cpu_aot_fuzz_calls$' -V` so contributors can reproduce the new experiment without navigating duplicated documentation. AGENTS.md reference: [AGENTS.md:L153-L156](https://github.com/R0Y00/Xbox2Windows/blob/f8407ade24da7f91b34a0a58982a7b3524980476/AGENTS.md#L153-L156) Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 02:15 UTC · original

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-24T02:15:24.682755Z f8407ad Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#issuecomment-7119928964) <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"f8407ade24da7f91b34a0a58982a7b3524980476","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-11-24T02:15:24.682755Z">2026-11-24T02:15:24.682755Z</relative-time> | `f8407ad` | Draft marked ready | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:17 UTC · original

Fixed the bot finding: the cpu_aot_fuzz_calls paragraph in docs/experiments.md had lost the $ of its regex to shell expansion, which also pulled in a duplicated copy of the document tail. The file is restored from the base with only the three intended paragraphs changed (4 insertions, 2 changes against base), the command reads ctest --preset dev --no-tests=error -R '^cpu_aot_fuzz_calls$' -V, and origin/main is merged in (no force). Code and CMake were not touched by this fix. AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#issuecomment-7119984167) Fixed the bot finding: the `cpu_aot_fuzz_calls` paragraph in `docs/experiments.md` had lost the `$` of its regex to shell expansion, which also pulled in a duplicated copy of the document tail. The file is restored from the base with only the three intended paragraphs changed (4 insertions, 2 changes against base), the command reads `ctest --preset dev --no-tests=error -R '^cpu_aot_fuzz_calls$' -V`, and origin/main is merged in (no force). Code and CMake were not touched by this fix. AI-assisted.
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 02:23 UTC · original

Thanks for restoring the docs and keeping the work distinct. We are reviewing the direct-call baseline in #1164 first. The native/default-/O2 comparison and its wrong-callee control passed locally. Once the baseline lands, your deeper call chains, skipped conditional calls and unexported callees would be useful as a focused follow-up. Please keep those cases and any distinct control that catches something the baseline misses.

**@⁠R0Y00** on GitHub · 2026-11-24 02:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#issuecomment-7120098337) Thanks for restoring the docs and keeping the work distinct. We are reviewing the direct-call baseline in #1164 first. The native/default-/O2 comparison and its wrong-callee control passed locally. Once the baseline lands, your deeper call chains, skipped conditional calls and unexported callees would be useful as a focused follow-up. Please keep those cases and any distinct control that catches something the baseline misses.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:45 UTC · original

Thanks, that sounds right. Once #1164 is on main I will rebase this branch as a focused follow-up: deeper call chains, skipped conditional calls, unexported callees, and any control that catches something the direct-call baseline misses. I will drop whatever #1164 already covers so the diff stays small.

AI-assisted.

**@⁠tedin7** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#issuecomment-7120455593) Thanks, that sounds right. Once #1164 is on main I will rebase this branch as a focused follow-up: deeper call chains, skipped conditional calls, unexported callees, and any control that catches something the direct-call baseline misses. I will drop whatever #1164 already covers so the diff stays small. AI-assisted.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:53 UTC · original

AI-assisted. Rebased onto the merged #1164 (merge commit, no force push). What is left is only what the baseline does not cover: callees that no export names, call chains up to four calls long that nest two levels deep, calls skipped behind a conditional, and tail jumps to framed callees, as a separate --area chains / cpu_aot_fuzz_chains. The distinct control is swapped call arguments, not a retargeted call. The baseline's own generators, clobber callee and controls are not duplicated; the new code reuses its helpers. Local Linux run (Wine): clean 0 of 5008 mismatches, mutant 3711 of 5008, baseline calls unchanged. Waiting for the 4 CI jobs.

**@⁠tedin7** on GitHub · 2026-11-24 02:53 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#issuecomment-7120573113) AI-assisted. Rebased onto the merged #1164 (merge commit, no force push). What is left is only what the baseline does not cover: callees that no export names, call chains up to four calls long that nest two levels deep, calls skipped behind a conditional, and tail jumps to framed callees, as a separate `--area chains` / `cpu_aot_fuzz_chains`. The distinct control is swapped call arguments, not a retargeted call. The baseline's own generators, clobber callee and controls are not duplicated; the new code reuses its helpers. Local Linux run (Wine): clean 0 of 5008 mismatches, mutant 3711 of 5008, baseline `calls` unchanged. Waiting for the 4 CI jobs.
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-11-24 02:15 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f8407ade24

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1129#pullrequestreview-6032630118) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `f8407ade24` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
This discussion has been locked. Commenting is limited to contributors.
No description provided.