refactor(evm): extract shared jump target resolution pass into bytecode cache#462
Open
ZR74 wants to merge 3 commits into
Open
refactor(evm): extract shared jump target resolution pass into bytecode cache#462ZR74 wants to merge 3 commits into
ZR74 wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors EVM bytecode analysis by extracting a shared “constant jump target resolution” pass into the bytecode cache, so both the SPP gas optimizer and the MIR/SSA liftability analysis can consume the same precomputed results.
Changes:
- Add a
ResolvedJumpTargetsmap toEVMBytecodeCacheand populate it duringbuildBytecodeCache()using an abstract stack simulation pass. - Update SPP gas-chunk construction to use the pre-resolved jump targets instead of local PUSH+JUMP pattern matching.
- Plumb the shared resolved-target map through the compiler frontend context into
EVMAnalyzeras a fallback resolution source.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/evm/evm_cache.h | Adds cached storage for resolved constant jump targets. |
| src/evm/evm_cache.cpp | Implements shared abstract-stack jump resolution and consumes it in SPP gas chunk building. |
| src/compiler/evm_frontend/evm_mir_compiler.h | Extends frontend context API to carry resolved jump-target map pointer. |
| src/compiler/evm_frontend/evm_analyzer.h | Adds optional fallback jump-target resolution via shared cache. |
| src/compiler/evm_compiler.cpp | Passes module cache’s resolved jump targets into the frontend context. |
| src/action/evm_bytecode_visitor.h | Wires frontend context’s resolved targets into EVMAnalyzer before analysis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
⚡ Performance Regression Check Results✅ Performance Check Passed (interpreter)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions ✅ Performance Check Passed (multipass)Performance Benchmark Results (threshold: 25%)
Summary: 194 benchmarks, 0 regressions |
ZR74
added a commit
to ZR74/DTVM
that referenced
this pull request
Apr 27, 2026
…k#462) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Store raw (non-canonicalized) JUMPDEST PCs in ResolvedJumpTargets so SPP gas blocks correctly account for intermediate JUMPDESTs in consecutive runs. The SSA analyzer canonicalizes in its own consumer. - Pass the caller's evmc_revision metrics table into the shared pass instead of hardcoding DEFAULT_REVISION, so opcodes like PUSH0 get correct stack effects under their respective revisions. - Add clarifying comment for the JUMPI case where a known-constant destination is not a valid JUMPDEST (intentional: traps at runtime). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…k#462) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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.
…de cache
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
2. What is the scope of this PR (e.g. component or file name):
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links:
6. Release note