-
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
Use side-effects of user defined functions in evm code transform. #12132
Conversation
3149036
to
785e16f
Compare
245c277
to
be6fb5f
Compare
21386df
to
89dbc9b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
4be8f36
to
1a56588
Compare
1a56588
to
7d2fc5a
Compare
@@ -490,14 +490,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block) | |||
createStackLayout(debugDataOf(_functionReturn), exitStack); | |||
m_assembly.appendJump(0, AbstractAssembly::JumpType::OutOfFunction); | |||
}, | |||
[&](CFG::BasicBlock::Terminated const&) | |||
{ | |||
// Assert that the last builtin call was in fact terminating. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah - if we wanted to, we could of course drag along the entire logic into the code transform as well and keep validating things here - but I guess it's fine to trust that it's ok.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added at least some validation back, even though it relies on functionCall->canContinue
to be correct. But conceptually that's fine - the canContinue
flag is part of the CFG and the code transform only guarantees correctness relative to the CFG...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just needs simple test updates, but is good to go otherwise, isn't it? So I'm approving modulo the tests.
No gas cost updates on this, though? Makes me wonder if this really just doesn't happen or if the gas expectations are just not properly updated and checked...
5d64479
to
cf443ea
Compare
Ok this is weird - now there are gas changes... |
test/libsolidity/semanticTests/array/function_array_cross_calls.sol
Outdated
Show resolved
Hide resolved
test/libsolidity/semanticTests/externalContracts/deposit_contract.sol
Outdated
Show resolved
Hide resolved
test/libsolidity/semanticTests/externalContracts/deposit_contract.sol
Outdated
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
Another optimization here could be that we should not push a return tag for a call to a terminating function. |
2e34906
to
8a85e7d
Compare
8a85e7d
to
fcdc339
Compare
908e93a
to
2324a15
Compare
2324a15
to
5e63b62
Compare
I rebased this and updated the gas costs |
This pull request is stale because it has been open for 14 days with no activity. |
b63d4a4
to
6651394
Compare
6651394
to
4c23d00
Compare
Unstaled and rebased this once more - this is mainly in dire need of reviews. If anyone is up for this, ping me and I can walk you trough the PR to help in reviewing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs another rebase.
Code looks good! |
4c23d00
to
dd8b3f5
Compare
dd8b3f5
to
1b6063e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving based on @chriseth's approval above.
I tried but failed. Assigning to @ekpyron
Depends on #12759 and #12795