cpu: keep the jump-table unsupported-instruction control unsupported #1381

Merged
Maxim-Root merged 1 commit from upstream-pr/1388 into main 2026-11-24 10:27:53 +00:00
Maxim-Root commented 2026-11-24 10:16:34 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by Maxim-Root on 2026-11-24T10:16:34Z.


Change

cpu_aot_jump_tables fails on main since #1374 (384ee4ac, "cpu: lift BSWAP in the switch translator"):

AssertionError: accepted control: unsupported instruction

tests/cpu/switch_check.py keeps a rejection control that patches the two-byte NOT in the jump-table fixture with 0f ca (BSWAP EDX) and expects unsupported instruction. #1374 made the switch translator lift BSWAP and moved the matching control in switch_bit_counts to XLATB, but this second control still used BSWAP. The translator now accepts it, so the check fails before the flag-consumer controls run.

This PR replaces the patch bytes with 0f a2 (CPUID). It is also two bytes, so the decode stream after it is unchanged. The switch translator has no CPUID lowering, and its result depends on the host processor, so it stays out of the translator's scope. The expected reason, unsupported instruction, and the other 15 controls are unchanged. Only tests/cpu/switch_check.py changes (one line plus a comment).

The PR check did not catch this because the pr preset does not include cpu_aot_jump_tables. The main runs of the full suites that would have caught it were cancelled by the next pushes (concurrency group), so the regression has not shown up in CI yet.

Refs #1374.

Verification

Windows 11 Pro 26300.9818, MSVC 14.44.35207, Python 3.12.10, at 816fb71b (main):

ctest --preset dev --no-tests=error -R '^cpu_aot_jump_tables$' -V
  • Without this change: AssertionError: accepted control: unsupported instruction, 0/1. The same failure occurs at 7261ab67.

  • With this change:

    600 selector pairs per table layout and 138 programs match on return, guarded store, RBX and RSI; ...
    16 rejection controls and the leaf-without-unwind translation passed
    3 flag-consumer rejection controls passed
    100% tests passed, 0 tests failed out of 1
    
  • ctest --preset dev --no-tests=error -R '^cpu_aot_(jump_tables|switch)' -j 16: 10/10.

  • The same filter with --preset release (/O2): 10/10.

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. (No new fixture; the changed control still has to be rejected, and it is.)
  • I updated README/docs when a capability or build requirement changed. (No change.)
  • I did not include game files, dumps, distribution links or secrets.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6579537393 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1388). Originally posted by [Maxim-Root](https://github.com/Maxim-Root) on 2026-11-24T10:16:34Z. --- ## Change `cpu_aot_jump_tables` fails on `main` since #1374 (`384ee4ac`, "cpu: lift BSWAP in the switch translator"): ```text AssertionError: accepted control: unsupported instruction ``` `tests/cpu/switch_check.py` keeps a rejection control that patches the two-byte `NOT` in the jump-table fixture with `0f ca` (`BSWAP EDX`) and expects `unsupported instruction`. #1374 made the switch translator lift BSWAP and moved the matching control in `switch_bit_counts` to XLATB, but this second control still used BSWAP. The translator now accepts it, so the check fails before the flag-consumer controls run. This PR replaces the patch bytes with `0f a2` (`CPUID`). It is also two bytes, so the decode stream after it is unchanged. The switch translator has no CPUID lowering, and its result depends on the host processor, so it stays out of the translator's scope. The expected reason, `unsupported instruction`, and the other 15 controls are unchanged. Only `tests/cpu/switch_check.py` changes (one line plus a comment). The PR check did not catch this because the `pr` preset does not include `cpu_aot_jump_tables`. The `main` runs of the full suites that would have caught it were cancelled by the next pushes (`concurrency` group), so the regression has not shown up in CI yet. Refs #1374. ## Verification Windows 11 Pro 26300.9818, MSVC 14.44.35207, Python 3.12.10, at `816fb71b` (`main`): ```powershell ctest --preset dev --no-tests=error -R '^cpu_aot_jump_tables$' -V ``` - **Without this change:** `AssertionError: accepted control: unsupported instruction`, 0/1. The same failure occurs at `7261ab67`. - **With this change:** ```text 600 selector pairs per table layout and 138 programs match on return, guarded store, RBX and RSI; ... 16 rejection controls and the leaf-without-unwind translation passed 3 flag-consumer rejection controls passed 100% tests passed, 0 tests failed out of 1 ``` - `ctest --preset dev --no-tests=error -R '^cpu_aot_(jump_tables|switch)' -j 16`: 10/10. - The same filter with `--preset release` (`/O2`): 10/10. ## 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. (No new fixture; the changed control still has to be rejected, and it is.) - [x] I updated README/docs when a capability or build requirement changed. (No change.) - [x] I did not include game files, dumps, distribution links or secrets. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
upstream-sync closed this pull request 2026-11-24 11:02:45 +00:00
tedin7 commented 2026-11-24 11:02:46 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T10:33:04Z.

Review: COMMENTED


Reviewed a2e2a905 (cpu: keep the jump-table unsupported-instruction control unsupported).

  • Diff & audit:
    • git diff --check clean; 100% title-neutral.
    • tests/cpu/switch_check.py: replaces 0f ca (bswap edx, now lifted since #1374) with 0f a2 (cpuid), keeping the "unsupported instruction" negative control valid.
  • Linux checks:
    • py_compile tests/cpu/switch_check.py and tests/bidi_controls_check.py (1172 tracked files): passed.
  • Windows Server 2025 (Build 26100, MSVC 14.44.35207) at a2e2a905207621ff606395950984b372b0d2e32b:
    • Debug (--preset dev): cpu_aot_jump_tables 1/1 passed (0.43s).
    • Release /O2 (--preset release): cpu_aot_jump_tables 1/1 passed (0.43s).
<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6037613189 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1388#pullrequestreview-6037613189). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T10:33:04Z. **Review:** COMMENTED --- Reviewed `a2e2a905` (`cpu: keep the jump-table unsupported-instruction control unsupported`). - **Diff & audit**: - `git diff --check` clean; 100% title-neutral. - `tests/cpu/switch_check.py`: replaces `0f ca` (`bswap edx`, now lifted since `#1374`) with `0f a2` (`cpuid`), keeping the `"unsupported instruction"` negative control valid. - **Linux checks**: - `py_compile tests/cpu/switch_check.py` and `tests/bidi_controls_check.py` (1172 tracked files): passed. - **Windows Server 2025 (Build 26100, MSVC 14.44.35207)** at `a2e2a905207621ff606395950984b372b0d2e32b`: - **Debug (`--preset dev`)**: `cpu_aot_jump_tables` **1/1 passed** (`0.43s`). - **Release `/O2` (`--preset release`)**: `cpu_aot_jump_tables` **1/1 passed** (`0.43s`).
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!1381
No description provided.