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

Manually merged
github merged 1 commit from gh-pr/1388/head into gh-pr/1388/base 2026-11-26 23:03:19 +00:00
Owner

@⁠Maxim-Root on GitHub · 2026-11-24 10:16 UTC · original
Maxim-Root:cpu/jump-tables-unsupported-control → main · +2 −1 · 1 files · 1 commits · merged 2026-11-24 10:27 UTC

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

**@⁠Maxim-Root** on GitHub · 2026-11-24 10:16 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1388) `Maxim-Root:cpu/jump-tables-unsupported-control` → `main` · +2 −1 · 1 files · 1 commits · merged 2026-11-24 10:27 UTC ## 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)
cpu_aot_jump_tables patched the two-byte NOT with 0f ca (BSWAP EDX) as an
unsupported instruction. #1374 made the switch translator lift BSWAP, so
the control was accepted and the check failed with "accepted control:
unsupported instruction". Patch the same two bytes with CPUID (0f a2),
which the translator does not lower.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 23:03:17 +00:00
github manually merged commit a2e2a90520 into gh-pr/1388/base 2026-11-26 23:03:19 +00:00
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 10:33 UTC · original · reviewed

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).
**@⁠tedin7** on GitHub · 2026-11-24 10:33 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1388#pullrequestreview-6037613189) · **reviewed** 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`).
This discussion has been locked. Commenting is limited to contributors.
No description provided.