LATX: optimize stack updates and share helper stubs - #460
Open
y347812075 wants to merge 3 commits into
Open
Conversation
Track a pending stack pointer delta while lowering consecutive register or immediate PUSH and register POP instructions. Fold the delta into stack accesses and materialize it at stack-sensitive instructions and TB boundaries. Store the pending delta in restore metadata so faults and signals expose the precise guest stack pointer. Keep the existing IR2 optimizer as a mutually exclusive compile-time rollback path. Add x86_64 and i386 integration coverage for widths, stack aliases, helper boundaries, protected-page faults, signal context restore, file mappings, and legacy stack instructions. Signed-off-by: yuerengan <y347812075@163.com>
Generate process-wide default and no-FP prologue and epilogue stubs for helpers that use common save and restore contracts. Prepare arguments and call the original helper between the stubs so argument registers do not require helper-specific handling. Route full-state instruction helpers and no-FP SMC store helpers through the matching stubs. Preserve address temporaries that remain live across a shared prologue because its independent register allocator may reuse the same host register. Keep FP80 conversion, return-register-sensitive paths, and every original inline SMC save and restore path as fallbacks when LATX_STATIC_HELPER=0. Relocate all four stub addresses for AOT and retain strict runtime and statistics switches. Add integration coverage for live RIP-relative helper arguments, common and no-FP helper paths, asynchronous signals, self-modifying stores, guest state, option validation, and inline/static equivalence. Signed-off-by: yuerengan <y347812075@163.com>
Record the LATX_STATIC_HELPER mode in every generated AOT header and reject cached code when the current runtime mode differs. This keeps the rollback switch effective for previously generated code and makes mode changes fall back to JIT regeneration. Bump the AOT footer version so caches written before the new header field are never interpreted using padding data. Apply the same compatibility check to normal and merged AOT loads, and cover both mode transitions in the cache reader test. Signed-off-by: yuerengan <y347812075@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.
Summary / 变更说明
register/immediate PUSH and register POP instructions. Fold the delta into
stack accesses, materialize it at stack-sensitive boundaries, and retain
precise restore metadata for faults and signals.
route compatible helper call sites through them. Preserve live address
temporaries across the shared prologue and keep the original inline paths
available with
LATX_STATIC_HELPER=0.caches when the runtime mode changes, including normal and merged caches,
so the rollback switch remains effective.
Validation / 验证
ninja -C build32 latx-i386ninja -C build64 latx-x86_64 test-latx-aot-cache-readertest-static-helper-stubs.sh: passed.test-static-helper-live-temp.sh: passed.1 -> 0 -> 1, correct guest outputafter each transition and regenerated headers matched the selected mode.
latx-integrationsuite: 21 passed, 2 skipped; 3 existingenvironment-dependent failures remained (namespace/longjmp and static
link
memset).scripts/checkpatch.pl --no-tree --strict: 0 errors for all three commits;the first two commits only report the generic MAINTAINERS warning for new
integration test files, and the AOT fix reports 0 warnings.
Checklist / 检查项
CONTRIBUTING.md. / 我已阅读CONTRIBUTING.md。git commit -s). /每个提交都包含 DCO 签署(
git commit -s)。are not applicable. /
我已提供相关构建或测试结果,或说明了不适用的原因。