x64_recomp: add xlat/xlatb and enter emitters (X64-RECOMP-XLAT-ENTER) #1383
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1383"
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 ubiquitarianism/leonida. Originally posted by quietfold on 2026-11-24T23:01:54Z.
Item ID:
X64-RECOMP-XLAT-ENTERSummary
Adds AArch64 emitters for
xlat/xlatb(0xD7) andenter(0xC8) intools/x64_recomp.py:xlat/xlatb(0xD7):PRIMARY[0xD7]from("xlat", "sys")to("xlat", "")and classified"xlat"as"misc"sodecode_oneand_emit_onehandle it directly instead of rejecting it as an unhandled system instruction.AL := *(uint8_t *)(base + zero_extend(AL))wherebaseisRBX(or zero-extendedEBXunder67address-size override,ins.addrsize == 1), inserting only the low 8 bits intoRAXviabfiso the upper 56 bits ofRAXand all flags are preserved.enter imm16, imm8(0xC8):"enter"as"misc"(was already decoded byPRIMARY[0xC8] = ("enter", "iw,ib")) and added_emit_enter.RBP, snapshotsframe_temp = RSP, copiesnesting - 1lexical display frame pointers from[RBP - 8*i]and pushesframe_tempwhen(imm8 & 31) > 0, setsRBP = frame_temp, and subtracts unsignedalloc = imm16 & 0xFFFFfromRSP(supportingalloc >= 4096without overflowing ARMSUB (immediate)). Preserves all flags.Tests & Verification
upstream/main28a32e190):python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/x64_recomp.py tests/test_x64_recomp_xlat_enter.py— OKpython3 -I tests/test_x64_recomp_xlat_enter.py— 1 static test OK (3 exec tests skip cleanly without#1174runner)python3 -I tests/test_x64_recomp.py— 6 static OK (26 exec skipped)python3 -I tests/test_text_write_line_endings.py— 3/3 OKtests/test_x64_recomp_xlat_enter.pyagainst unpatchedupstream/mainfails with 8 assertion failures.#1174+ all 17 other openx64_recompPR branches):tests/test_x64_recomp_xlat_enter.py: 4/4 OK (0 skipped) on native Apple M5 arm64tests/test_x64_recomp_*.pysuites combined: 132/132 OK (0 skipped)Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-24T23:02:04Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by kevincommits on 2026-11-25T23:24:51Z.
Independent run with QEMU. Apple M5 Pro, macOS 27.2.1 (26B131), Python 3.14.2, QEMU 11.1.3 from Homebrew. I merged
mainatcb1d5f57finto the branch locally (826 commits behind, no conflicts). Head tested:2193b80d0.The emitters pass every case in the file under QEMU. The file as shipped fails for the wiring reason in #1409.
python -I tests/test_x64_recomp_xlat_enter.pyis 4 run, 6 failures._runner's QEMU branch returnsxr.run_kernel(raw bytes) wherexr.run_result(parsed value) is needed. Suggested fix:xr.run_resultin both branches.RUNNERswapped forxr.run_resultin memory (no file changed): 4/4 pass on this branch, includingenterat nesting 0 to 3 with the large allocation,xlatwith high indices and the upper bits of rax kept, and the flag-preservation cases.main'stools/x64_recomp.py: the six exec cases error (both instructions are unhandled there) and the three static checks fail, so the tests do fail before and pass after.Counts.
tests/test_x64_recomp.py33/33 andtests/test_recomp_census.py11/11, the same asmain. Full standalone suite: 512 run, 507 pass; the 5 that fail aremain's 4 plus the new file, for the wiring reason.I ran the pull request's own cases and wrote no extra ones. No game files used. AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T14:34:49Z.
Red/green: classified READY by dada-lotF (red on main, green on head merged with main); head
2193b80d05unchanged since 2026-11-24, before that run.Targeted batch (PR tests, tests importing the changed modules, docs tests, translator when touched) merged on main
d48a957bbin GitHub Actions: no new failure.AI-assisted (Claude Code, Claude Opus 5.5)