Repository navigation
perf(vm): optimize cached JUMPDEST analysis - #7067
Open
yanghang8612 wants to merge 2 commits into
Open
yanghang8612 wants to merge 2 commits into
yanghang8612 wants to merge 2 commits into
Conversation
Replace the HashSet of program counters. Cache key, size, and admission stay the same.
yanghang8612
force-pushed
the
opt/jumpdest-cache
branch
from
October 27, 2026 09:26
c982146 to
edc038e
Compare
|
The bitmap is a compact way to preserve the existing JUMPDEST lookup behavior. Would it be worth adding lightweight cache hit/miss counters in |
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.
What does this PR do?
Optimize each cached JUMPDEST analysis by storing positions in a bitmap instead of a HashSet of program counters. The scan is unchanged: a JUMPDEST opcode is recorded, and the immediate bytes of PUSH1 through PUSH32 are still skipped. A program counter outside the code returns false.
The cache key, the entry cap, and energy charging stay the same. A constant call still compiles on the frame and is not inserted into the cache.
Why are these changes required?
Each cached analysis kept one boxed integer per JUMPDEST. The bitmap records the same positions and substantially reduces the space occupied by the cache.
This PR has been tested by:
JumpDestBitmapTest checks the bitmap against the previous scan, including PUSH immediate data, a single destination among other bytes, and random code.
Follow up
A failed CREATE analysis is still inserted into the cache. This change does not remove those entries.
Extra details
A finished analysis reports the same JUMPDEST positions as before, so this does not require a proposal gate.