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

Never inline the prepare functions #712

Merged
merged 1 commit into from
Sep 11, 2023

Conversation

valo
Copy link
Contributor

@valo valo commented Sep 11, 2023

These functions are used for keeping the stack memory clean on the host recursive code paths. EVM supports up to 1024 levels of recursion, so if one is not careful with the stack memory allocations, the stack memory can blow up.

Benchmarks show dramatic stack memory improvements when ont inlining these functions. A recursive bomb uses around 1.1MB of stack when these functions are not inlined. If inlined the recursive bombs blow up the stack.

Fixes #589

These functions are used for keeping the stack memory clean on the
host recursive code paths. EVM supports up to 1024 levels of recursion,
so if one is not careful with the stack memory allocations, the stack
memory can blow up.

Benchmarks show dramatic stack memory improvements when ont inlining
these functions. A recursive bomb uses around 1.1MB of stack when
these functions are not inlined. If inlined the recursive bombs blow
up the stack.
@rakita
Copy link
Member

rakita commented Sep 11, 2023

nice!

@rakita rakita merged commit 190f90e into bluealloy:main Sep 11, 2023
mikelodder7 pushed a commit to LIT-Protocol/revm that referenced this pull request Sep 12, 2023
These functions are used for keeping the stack memory clean on the
host recursive code paths. EVM supports up to 1024 levels of recursion,
so if one is not careful with the stack memory allocations, the stack
memory can blow up.

Benchmarks show dramatic stack memory improvements when ont inlining
these functions. A recursive bomb uses around 1.1MB of stack when
these functions are not inlined. If inlined the recursive bombs blow
up the stack.
Evalir pushed a commit to Evalir/revm that referenced this pull request Sep 14, 2023
These functions are used for keeping the stack memory clean on the
host recursive code paths. EVM supports up to 1024 levels of recursion,
so if one is not careful with the stack memory allocations, the stack
memory can blow up.

Benchmarks show dramatic stack memory improvements when ont inlining
these functions. A recursive bomb uses around 1.1MB of stack when
these functions are not inlined. If inlined the recursive bombs blow
up the stack.
@github-actions github-actions bot mentioned this pull request Jan 12, 2024
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.

Test overflowed the stack
2 participants