-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
[Yul Optimizer] Consider moving statically sized memory allocations to static offsets while adjusting the memoryguard
#13046
Comments
Thinking about it a bit more: this could be similar to what the stack limit evader does, but it's not entirely the same: And also on function calls the logic would have to differ, since multiple calls to the same function in general may need to get distinct memory chunks. So yeah, this would need to rely on arguing that the allocated memory is only used function-locally... But it might still be worthwhile, even if we have to restrict the cases in which this is allowed significantly at first. |
So basically the issue will be to determine which allocations can safely be turned to static ones... which may lead back to full memory objects... but at least the rest, i.e. assigning distinct static offsets for such allocations, could probably be shared with the current stack-to-memory logic... |
Related to #5107 |
This issue has been marked as stale due to inactivity for the last 90 days. |
Hi everyone! This issue has been automatically closed due to inactivity. |
Could, in principle, realize that all non-reverting branches need 64 bytes of static memory, shift the memoryguard and transform to:
The logic would
basically be the same asbe similar to the allocation of memory slots in the stack-to-memory process.However, there'd be some subtleties involved... e.g. we'd need to decide how to tradeoff between branches requiring more or less static memory (also considering whether we want to ignore reverting branches).
Also this would mean special handling for
allocate
and would benefit from having it as a builtin in an initial dialect or something similar...A huge advantage, though, would be that after such a transformation it would be much easier to reason about those allocations, since they'd have well-known static offsets.
The text was updated successfully, but these errors were encountered: