-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Add verbatim builtin. #11123
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
Add verbatim builtin. #11123
Conversation
861cc49
to
34a260e
Compare
8fe91a8
to
de3bad9
Compare
We might need to make the side-effects a bit worse, by the way: This could use msize and so on. |
94151ac
to
c56a1c5
Compare
a96c2b4
to
dc91ba7
Compare
I think Changelog item should be added. |
2545e35
to
f04adde
Compare
Added the check to the optimizer test. |
@@ -302,6 +317,9 @@ BuiltinFunctionForEVM const* EVMDialect::builtin(YulString _name) const | |||
|
|||
bool EVMDialect::reservedIdentifier(YulString _name) const | |||
{ | |||
if (m_objectAccess) |
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.
Had to re-read the actual source code (not this PR). It seems for the other builtins, we have reserved them in Yul entirely, not just for the object version.
If we do it here, are we afraid some people use verbatim*
in inline assembly? We should aim to reserve it in 0.9.0 at least, if so. (Or perhaps by that time verbatim will be supported in inline assembly?)
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.
Sounds good!
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'm confused, what is the verdict? We lave it as-is and change it in 0.9.0?
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.
Yes!
Re-checked the EVMASM optimizer:
|
A test to print the side effects
Here is a stack trace:
The problem is https://github.com/ethereum/solidity/blob/verbatimdata/libyul/optimiser/Semantics.cpp#L139. Not sure why it should get to that branch. Also don't have a direct example that throws. (Turns out that |
@hrkrshnn what is the command you run? |
ah, `functionSideEffects' in isoltest? |
Depends on #11292 |
fe8bdfb
to
40c4fea
Compare
Added a couple of tests #11316 |
@@ -162,6 +176,9 @@ class AssemblyItem | |||
AssemblyItemType m_type; | |||
Instruction m_instruction; ///< Only valid if m_type == Operation | |||
std::shared_ptr<u256> m_data; ///< Only valid if m_type != Operation | |||
/// If m_type == VerbatimBytecode, this holds number of arguments, number of | |||
/// return variables and verbatim bytecode. | |||
std::optional<std::tuple<size_t, size_t, bytes>> m_verbatimBytecode; |
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.
Oh, this got increased to three members? I think it should really be documented what they are, I assume args
,rets
,data
?
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.
Two lines up?
Fixes #10869
This seems to work end-to-end.
Needs: