-
Notifications
You must be signed in to change notification settings - Fork 358
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
feat: EVM Interpreter in Yul #327
Conversation
… sstore instruction
This way it reflects the official docs
…king Add gas tracking and properly return values instead of relying on the sstore instruction
[EVM-Equivalent-YUL] Add `or` and `push` implementation
[EVM-Equivalent-YUL] Add exp and signextend opcodes
[EVM-Equivalent-YUL] Add addmod and mulmod opcodes
With this change, the function will stop doing N (from pushN) `add`s, but only one, whatever N be.
[EVM-Equivalent-YUL] Add div, sdiv, mod, smod opcodes
[EVM-Equivalent-YUL] Optimize readBytes function used by pushN opcodes
…xpansion [EVM-Equivalent-Yul] Add memory expansion functions
[EVM-Equivalent-Yul] Add mload, mstore and mstore8 opcodes
[EVM-Equivalent-YUL] Stack/Memory instructions sload, sstore and msize
[EVM-Equivalent-Yul] Add some environment opcodes
[EVM-Equivalent-Yul] Add more environment opcodes
…odes [EVM-Equivalent-YUL] Add block-environment opcodes
[EVM-Equivalent-Yul] Add gas charge to lacking opcodes
|
||
ip := add(ip, 1) | ||
|
||
switch opcode |
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 believe YUL handling of switch statements is very inefficient. You may need to write this in BALLS instead.
} | ||
|
||
function pushStackItem(sp, item) -> newSp { | ||
if or(gt(sp, BYTECODE_OFFSET()), eq(sp, BYTECODE_OFFSET())) { |
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 have an off-by-one here? I think you might be able to write to BYTECODE_OFFSET()
.
opcode := and(mload(sub(ip, 31)), 0xff) | ||
} | ||
|
||
function readBytes(start, length) -> value { |
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.
length
is a constant and this function will be specialized anyways -- maybe you should mask here instead of using a loop?
What ❔
Why ❔
Checklist