-
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
Add bit shifting opcodes (EIP145) #2541
Conversation
7bb0dd5
to
4da634f
Compare
Perhaps it makes sense to introduce a meta programming language at least for plain assembly / julia files that can specify new functions, what their arguments and return values are and which EVM opcode they map to. |
This needs tests, but that can only be added when ethereum/aleth#4054 is finished. |
Should use the new |
d78fc1f
to
6d21714
Compare
@chriseth I'd like to merge this. When we introduce constantinople in evm-version, the warning can be replaced based on that. Pulled out the simplification rule. |
docs/assembly.rst
Outdated
@@ -202,6 +202,12 @@ In the grammar, opcodes are represented as pre-defined identifiers. | |||
+-------------------------+------+-----------------------------------------------------------------+ | |||
| byte(n, x) | | nth byte of x, where the most significant byte is the 0th byte | | |||
+-------------------------+------+-----------------------------------------------------------------+ | |||
| shl(x, y) | | logical shift left y by x | |
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.
We should add comments that tell the user which EVM version is required.
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.
Do you mean just a commit in the description or a new column at some point?
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.
Either a new column or just in parentheses.
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.
Perhaps a small column with H
/B
/C
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.
Thinking about reusing the middle column. It currently is used for empty (pushes one item), -
(doesn't push anything onto the stack), *
(special). It could just have B
for byzantium ones?
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.
Will add the C
after #3604 is merged.
_location, | ||
"The \"" + | ||
boost::to_lower_copy(instructionInfo(_instr).name) | ||
+ "\" instruction is experimental and not available in regular clients. " |
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.
Blockchains instead of clients? Ethereum implementations?
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.
Well since it was designated for constantinople we could just update the text to reflect that.
Need to update the analyser code to output warning dependent on EMV version (#3569). |
Updated the documentation and the warning message. |
docs/assembly.rst
Outdated
@@ -206,6 +206,12 @@ In the grammar, opcodes are represented as pre-defined identifiers. | |||
+-------------------------+-----+---+-----------------------------------------------------------------+ | |||
| byte(n, x) | | F | nth byte of x, where the most significant byte is the 0th byte | | |||
+-------------------------+-----+---+-----------------------------------------------------------------+ | |||
| shl(x, y) | | C | logical shift left y by x | |
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.
by x bits
?
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.
Fixed.
Supports https://github.com/ethereum/EIPs/blob/master/EIPS/eip-145.md.