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

[EVM] Implement spilling/reloading for stackification #719

Open
akiramenai opened this issue Oct 23, 2024 · 1 comment
Open

[EVM] Implement spilling/reloading for stackification #719

akiramenai opened this issue Oct 23, 2024 · 1 comment

Comments

@akiramenai
Copy link
Collaborator

In Solidity, the maximum stack depth is 1024 items, with each item being a 256-bit word. Additionally, the EVM can only access stack items that are up to 16 slots away from the top-most slot. Currently, when we need to access an item deeper than this limit, we first attempt to rematerialize slots that can be rematerialized (see #718), and if that fails, we throw an error.

Instead of failing, we should spill the slot using mstore and reload it later via mload. Ideally, we can reuse the spill/reload logic from the register allocation process, if applicable.

Additionally, we should make the stack depth threshold for spilling configurable, so we can evaluate whether it's more efficient to avoid fully occupying the stack.

@akiramenai
Copy link
Collaborator Author

It should make no use for Shuffler::dupDeepSlotIfRequired.

@akiramenai akiramenai changed the title Implement spilling/reloading for stackification [EVM] Implement spilling/reloading for stackification Oct 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant