cpu: lower 32-bit immediate RSP adjustments in cpu_chained_aot #252
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/255"
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 Vonsek on 2026-11-21T19:28:17Z.
Change
ADD_RM64_IMM32andSUB_RM64_IMM32onRSPintools/cpu_chained_aot.pyusingins.immediate32to64, while preserving the existing 8-byte alignment and[-4096, 0]frame-depth checks.USE_LARGE_FRAMEvariant (cpu_chained_frame) intests/cpu/chained.asmandCMakeLists.txtthat allocates and frees a 136-byte (0x88) frame (sub rsp, 136/add rsp, 136) with a stack spill and reload (mov [rsp + 32], rcx/mov rsi, [rsp + 32]) and matchingUWOP_ALLOC_LARGEunwind metadata.tests/cpu/chained_check.pyto differentially verifycpu_chained_frameagainstcpu_chained_frame_lifted, assert that the fixture emitsSUB_RM64_IMM32andADD_RM64_IMM32, and verify that patching the allocation to 4096 bytes (sp = -4112) is rejected withunsupported stack adjustment.Verification
Tested on Windows 11 (VS 2022 Build Tools 17.14, MSVC 19.44, ML64 14.44, Windows SDK 10.0.26100, Python 3.12):
cpu_chained_frame_liftedfailed with:cmake --build --preset dev --target cpu_chained_frame_liftedsucceeded (3 owned ranges, 3 return paths, indirect stops: []).ctest --preset dev --no-tests=error -R "chained|callback|destroy" -V: 3/3 passed (cpu_aot_destroy_contract,cpu_aot_object_callback,cpu_aot_chained_ranges).Evidence and follow-up
tools/cpu_chained_aot.pyalready enforced-4096 <= sp <= 0, but only decodedimm8RSP adjustments (ADD_RM64_IMM8/SUB_RM64_IMM8), which capped frames at 120 bytes.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:35:04Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
d50a8319cbℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:30:54Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
d50a831ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by Vonsek on 2026-11-21T19:41:24Z.
Added
cpu_chained_frame_liftedto the focused build command and updated the variant/control summary indocs/experiments.md.Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-21T19:35:04Z.
Code review location:
CMakeLists.txt; line 578On a freshly configured Windows build, the reproduction sequence in
docs/experiments.md:69-70now fails because its build command omitscpu_chained_frame_lifted. CMake's build help defines--targetas “Build instead of default targets,” and none of the documented targets depends on the new frame pair. This added CTest argument nevertheless makeschained_check.pyload both frame DLLs, producing a missing-DLL error. Addcpu_chained_frame_liftedto the documented build command; it also builds the native fixture and satisfies the reproduction-command update requirement inAGENTS.md.AGENTS.md reference: AGENTS.md:L145-L146
Useful? React with 👍 / 👎.