Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## evm/execution-context #1787 +/- ##
======================================================
Coverage 98.24% 98.24%
======================================================
Files 187 187
Lines 17208 17210 +2
Branches 3919 3919
======================================================
+ Hits 16906 16908 +2
Misses 233 233
Partials 69 69
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Contributor
get_execution_state() compared the depth with size(), which divides the vector's byte size by sizeof(ExecutionState): a multiplication by its inverse, and on rv64 also 7 instructions to build that 64-bit constant. Compare the pointer to the depth's state with the end instead. The depth is within the reserved capacity, so the pointer is too; a debug assert checks it before the pointer arithmetic. The lookup in execute() takes 4 instructions instead of 10 on x86 with GCC and Clang. execute() gets 6 to 8 instructions shorter on x86 and 11 on rv64 with zilkworm's SP1 guest flags. The dispatch loops don't change.
chfast
force-pushed
the
evm/execution-context-lookup
branch
from
October 27, 2026 20:44
cb44c76 to
9923925
Compare
This branch has not been deployed
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.
ExecutionContext::get_execution_state()compares the depth with the vector'ssize(), which divides its byte size bysizeof(ExecutionState)(424): a multiplication by the inverse, and on rv64 also 7 instructions to build that 64-bit constant. This compares the pointer to the depth's state with the end instead. The depth is within the reserved capacity of 1025 states, so the pointer stays inside the allocated array. A debug assert checks this before the pointer arithmetic, so a depth outside the contract still stops there, as it did in the slow path before.On x86 the lookup in
execute()becomesimul,add,cmp,jaeinstead of 10 instructions.execute()gets shorter by 8 instructions with GCC 15, 6 with GCC 14 and 7 with Clang 21, and by 11 on rv64 with zilkworm's SP1 guest flags. No other function changes, and the dispatch loops are identical with all four. Under callgrind, the CALL-heavy benchmark fixturesystem/return_revertruns 6 fewer instructions per message call (186,538 over 31,090 calls).Ported to zilkworm's evmone fork, it saves 0.025% of SP1 cycles on top of #1770 on a 100-block mainnet sample (2.30M of 9.37G cycles), with 99 of the 100 blocks faster and gas unchanged.