tests: gate the native compacted XRSTOR controls on XSAVEC #2333
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2341"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by lukaslw-lab on 2026-11-25T12:50:33Z.
Change
On a host with XSAVEOPT but no XSAVEC,
cpu_aot_xsave_stateran a native XRSTOR of a compacted image and stoppedwith #GP (
access violation reading 0xffffffffffffffff) (#2339). Intests/cpu/xsave_state_check.py:check_entry_state_contractstakeshas_xsavec. The native compacted restore in the entry-MXCSR control runsonly with it; the native standard-image comparison of the same export still runs on every host.
native_exports_for_hostdropsSSE_COMPACTED_CONTROL_EXPORTwithout XSAVEC, with the other compacted fixtures.op_xrstor64_avx_xsaveopt64_avxis kept.Test-only; the lifted checks and the translator are unchanged. Fixes #2339.
Verification
Commit
199c285f(oneda7cc3c) on Windows 10 22H2 (build 19045), Intel Core i7-4790K (XSAVEOPT, no XSAVEC),Visual Studio 2026 (MSVC 19.52), Python 3.13.7.
The script prints
200 native/lifted/reference XSAVE/XRSTOR cases across 20 exports matched bit-for-bit.tests/cpu/xsave_state_check.pyOSError: exception: access violation reading 0xFFFFFFFFFFFFFFFF, exit 1native_exports_for_host(..., has_xsavec=False, has_xsaveopt=True), upstreamSSE_COMPACTED_CONTROL_EXPORTop_xrstor64_avx_xsaveopt64_avxNot run here: the new gate assertions themselves. They sit in the block that runs only with XSAVEC, so CI's
runners execute them; the last two rows check the same function directly. The
releasepreset was not run.Evidence and follow-up
function for the XSAVEOPT-without-XSAVEC host (rows above).
Checklist
AI-assisted: prepared with Claude Code; the commands and results above were run on the author's PC.
🤖 Generated with Claude Code
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T12:51:53Z.
Review: COMMENTED
Review of head
199c285f7d8025de085c5744a57e56cebe9cc093(onlytests/cpu/xsave_state_check.py).Findings: 0 P1, 0 P2.
SSE_COMPACTED_CONTROL_EXPORT(op_xrstor64_sse_compacted_avx_xsaveopt64_avx) always restores a compacted image (XCOMP_BV[63] set). On a host without XSAVEC that native restore raises #GP, so gating it with the XSAVEC exports is right. It stays gated on XSAVEOPT too.check_entry_state_contractsnow takeshas_xsavecand skips only the native compacted restore. The native standard-image comparison still runs. The caller passes thehas_xsavecit already computed fromhost_has_xsavec.op_xrstor64_avx_xsaveopt64_avxstays. It also asserts that no XSAVEC or compacted export remains.Commands executed locally:
python3 tests/docs_links_check.py: PASS (19 files, 452 links)python3 tests/bidi_controls_check.py: PASSgit diff --check origin/main...HEAD: cleanpython3 -I -c "ast.parse(...)"on the file: syntax OKname != SSE_COMPACTED_CONTROL_EXPORTclause fromnative_exports_for_host. The newgated_optassertion then fails with AssertionError. Restored withgit checkout -- .; without the mutation the same assertions PASS.The native differential run needs Windows. This is a .py-only PR, so I rely on the pure-Python fast path plus the GitHub Windows CI.
AI-assisted; commands listed were executed locally.