-
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
Allow for unchecked function pointer jumps #12944
Comments
The main reason for having a dispatch function in Yul (rather than direct jumps like in the legacy codegen) is the expectation that the support for dynamic jumps in the EVM will eventually be removed. There's ongoing work on this and at some point we're likely to get some alternative mechanism, e.g. some opcodes for managing jump tables with a set of predefined destinations. Or a new variant of the jump opcode. This is actually a deeper discussion and @chfast, @axic, @ekpyron and @chriseth would probably like to chime in on this. I think that adding the old mechanism back through Also #12650 is a bit related to this. |
The reason we do not allow "goto" is more that we would otherwise have to remove some optimizations we are currently able to do. |
i guess i'm running into this i'm not sure how to check whether i am or not, but my gas costs go up noticeably when i enable viaIR and i make heavy use of calling functions by their pointer, so i assume this is at least contributing for me at least it seems these additional optimizations that @chriseth is pointing to (no pun intended) are less impactful overall than the cost of the slower dispatch also i'd be willing to measure whether this is indeed the gas problem i'm facing with viaIR if i could get some pointers (no pun intended) on how to do that |
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. |
Abstract
With
viaIR
&0.8.13
, there is an internal function dispatcher. This is quite the hefty gas overhead without anyway to breakout of it to do unchecked internal function calls.Motivation
It would be nice to be able to use the old version of direct jumps via
unchecked
or something in yul, even withviaIR
enabled.Specification
One solution may be something like the following:
Alternatively, could do something like:
Note: The change made to restrict function pointers to a known set makes sense, but there is no escape hatch for more optimized usage. The yul approach I think actually makes more sense long term as the optimizer could likely eventually recognize it doesn't need to do the internal function dispatching and can directly jump in certain cases.
Further alternative: finally allow
verbatim
in solidity contractsBackwards Compatibility
Fully compatible to my knowledge
The text was updated successfully, but these errors were encountered: