cpu: cover three repeated string-copy lowerings that no test observed #683

Merged
Leyukaka merged 1 commit from upstream-pr/689 into main 2026-11-22 21:11:23 +00:00
Leyukaka commented 2026-11-22 20:24:10 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Leyukaka on 2026-11-22T20:24:10Z.


Change

This closes three coverage gaps in the REP MOVS lowering of tools/cpu_switch_aot.py. Each was a one-line mutation that passed every cpu_ test on main. Only tests/cpu/switch_strings_check.py and the counts in docs/experiments.md change; the translator does not.

New case Mutation it covers
guard-page fault with rep movsb and RCX = 2^32 + 1 (must copy 3 bytes, then fault) RCX truncated to 32 bits before the loop
non-overlapping copies from an odd source address (257), next to the aligned one (256) forward stride grows by 1 for words and wider when RSI is odd
overlapping copy with the destination 8 bytes past the source bulk memmove for an 8-aligned forward overlap

The check now asserts that its storage base is even, so 257 is an odd address. The documented counts are updated to 38 exports, 18,192 comparisons and 84 access-violation comparisons, from this run.

Verification

On 66ddfad (branch on 3b9bb1a), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14:

ctest --preset dev --no-tests=error -j 4

296 of 297 pass. bvh_differential_warp failed once in that parallel run and passed twice when run alone (-R '^bvh_differential_warp$'); this PR does not touch it. tests/docs_links_check.py passes.

Each mutation was applied to tools/cpu_switch_aot.py one at a time, and all cpu_ tests were run. On main (b5509fe, after #598 to #600), all of them passed for each mutation. On this branch, each fails cpu_aot_switch_strings.

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. (Counts only.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6547338296 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/689). Originally posted by [Leyukaka](https://github.com/Leyukaka) on 2026-11-22T20:24:10Z. --- ## Change This closes three coverage gaps in the `REP MOVS` lowering of `tools/cpu_switch_aot.py`. Each was a one-line mutation that passed every `cpu_` test on `main`. Only `tests/cpu/switch_strings_check.py` and the counts in `docs/experiments.md` change; the translator does not. | New case | Mutation it covers | |---|---| | guard-page fault with `rep movsb` and RCX = 2^32 + 1 (must copy 3 bytes, then fault) | RCX truncated to 32 bits before the loop | | non-overlapping copies from an odd source address (257), next to the aligned one (256) | forward stride grows by 1 for words and wider when RSI is odd | | overlapping copy with the destination 8 bytes past the source | bulk `memmove` for an 8-aligned forward overlap | The check now asserts that its storage base is even, so 257 is an odd address. The documented counts are updated to 38 exports, 18,192 comparisons and 84 access-violation comparisons, from this run. ## Verification On `66ddfad` (branch on `3b9bb1a`), Windows 11 build 26300.9974, MSVC 14.44.35207, Python 3.14: ```text ctest --preset dev --no-tests=error -j 4 ``` 296 of 297 pass. `bvh_differential_warp` failed once in that parallel run and passed twice when run alone (`-R '^bvh_differential_warp$'`); this PR does not touch it. `tests/docs_links_check.py` passes. Each mutation was applied to `tools/cpu_switch_aot.py` one at a time, and all `cpu_` tests were run. On `main` (`b5509fe`, after #598 to #600), all of them passed for each mutation. On this branch, each fails `cpu_aot_switch_strings`. ## 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. (Counts only.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted.
upstream-sync closed this pull request 2026-11-24 06:44:20 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows!683
No description provided.