Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize stack usage for recursive call and create programs #522

Merged
merged 25 commits into from
Jul 3, 2023

Conversation

valo
Copy link
Contributor

@valo valo commented Jun 19, 2023

Fixes #305

With these changes the EVM state tests does not require increased stack in release mode. In debug mode, the stack need to be setup to 3MB.

The changes are in the create and call EVM implementations and optimize the stack usage of these code paths. The code is broken down into smaller functions, so that the stack memory footprint is kept low. Some of the larger parameters are moved to the heap using boxing.

valo added 7 commits June 17, 2023 18:09
This makes the stack footprint of the solidity function calls much
smaller
Simplification of the functions ensures that the stack is being kept
more lean. Also boxed some variables.

These changes allow running the currently blowing transactions with the
default stack size.
@valo valo marked this pull request as ready for review June 19, 2023 09:19
crates/revm/src/evm_impl.rs Outdated Show resolved Hide resolved
crates/revm/src/evm_impl.rs Outdated Show resolved Hide resolved
crates/revm/src/evm_impl.rs Outdated Show resolved Hide resolved
crates/revm/src/evm_impl.rs Outdated Show resolved Hide resolved
Copy link
Member

@rakita rakita left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Left a few comments but there are mostly related to moving some code, nothing serious, very nice PR!

valo added 4 commits June 23, 2023 17:36
These functions does not impact the stack memory footprint
The bytecode is included in the returned contract, so there is no need
to return it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Measure Interpreter call stack footprint
2 participants