Repository navigation
Conversation
Collaborator
|
I believe this PR is correct in terms of its logic, but the performance improvement is too small. To be on the safe side, this PR will not be merged for the time being. |
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.
The x86-64 dispatcher advances two pointers in lockstep on every decoded instruction. The trace is already interleaved: the handler address is the word immediately before the instruction. Load both through the instruction cursor, preserving the existing load order and indirect jump.
Use the freed register (
%r8) for the guest PC. Load it on entry and write it back at the common ASM exit, including on errors, syscalls and trace misses. The existing call wrapper already saves/restores this register around lazy frame initialization. This does not change the trace layout, decoder, prefetching, or cycle accounting. No cross-VM cache or AOT is involved.Local measurements (Linux x86-64, Ryzen AI 9 HX 370, pinned core, release build):
estimate_cycles, running therelease-0.24:benches/data/secp256k1_benchELF with the arguments fromvm_benchmark.rs. Fresh machine + ELF load + run; 30 warmups and 300 measured runs per process. Across seven alternating before/after pairs, the median of process medians went from 1.950 ms to 1.927 ms. Exit code 0 and 1,148,317 cycles on both builds. This is a small, workload-specific difference; individual runs overlap.Validation
make test-asm: 171 tests passed on Linux x86-64.make test-asm-chaos:tests/test_artifact.rs::test_artifactfails at the same assertion on the unmodified base and this branch. The other chaos tests passed.