Repository navigation
LATX, fix: Release dead operand and memory address temps - #525
Merged
LaurenIsACoder merged 2 commits intoOct 27, 2026
Merged
Conversation
Issue lat-opensource#524 exhausts itemp registers when a TEST memory operand is paired with CMOVcc while memory permission checks are enabled. The two TEST sources are dead after Eflags and the AND condition are emitted, so release them before translating CMOVcc. Add a static x86_64 guest covering LATX_MT=0/1/2 on 16K host pages. Signed-off-by: Zhaoyang Xie <xie_zyang@163.com>
Signed-off-by: Zhaoyang Xie <xie_zyang@163.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: LATX, fix: Release dead operand and memory address temps
Summary
Release the TEST source temporaries after flag calculation and the AND result have been emitted, before translating the paired conditional instruction. This reduces temporary-register pressure when TEST and CMOVcc both access memory and prevents the itemp exhaustion reported in #524 with LATX_MT=1/2 on 16KB-page hosts. Preserve the AND result and the same-register TEST path.
Release temporary addresses after scalar floating-point, XMM and YMM memory accesses, and after copying an internally allocated address to a specified LEA destination. Reuse the existing integer-memory release condition through ra_free_mem_temp(), preserving mapped guest registers and registers reserved for the immediate cache.
Add a self-checking static x86_64 TEST+CMOVcc fixture for LATX_MT=0/1/2 and register it in latx-integration. The register allocator and page-check fallback behavior are unchanged.
Fixes #524
Validation
Validated signed head 8e191ae on a LoongArch64 host with 16KB pages, based on freshly fetched upstream master 48a9c55. Both commits contain DCO sign-offs. Their source trees are identical to the previously reviewed commits; only sign-off trailers and commit metadata changed. The fast suite and the two focused integration tests below were rerun after the rewrite. Other results were obtained earlier from the identical source tree.
ninja -C build64andninja -C build32: passed; the existing build trees were up to date. This was an incremental verification, not a fresh configure/build.python3 lat/meson/meson.py test -C build64 --suite lat-pr-fast --print-errorlogs: 49/49 passed.python3 lat/meson/meson.py test -C build64 --suite latx-integration test-latx-mt-test-cmov-mem test-xcomis-patterns --print-errorlogs: 2/2 passed.itemp register exhausted, status=0x7fand passes against the candidate. An independent minimal guest was also run three times per mode: baseline LATX_MT=1/2 consistently received SIGABRT; candidate LATX_MT=0/1/2 always exited with status 0.rip-relative-cache.asmpassed with LATX_IMM_REG=0000 and 1111 when run directly through test-avx-regressions.py with LATX_AVX_PREBUILT unset. These runs include JIT, cold AOT and hot AOT; the runner verifies cache loading for hot AOT.The two corresponding Meson cache-test entries failed before guest execution because they set LATX_AVX_PREBUILT to an empty string, which the unchanged runner interprets as a prebuilt-fixture directory. Direct equivalent commands passed:
test-latx-16k-page-permission-i386was skipped because clang was unavailable. No i386 runtime result, original Wine/Notepad++ workload result for this candidate, or performance benchmark is claimed. The address-release changes have no dedicated register-exhaustion RED/GREEN test.Commands above are relative to the parent of the lat checkout, which contains build64 and build32.
Checklist
CONTRIBUTING.md.git commit -s).