Skip to content
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

fix[docs]: fix venom examples #4475

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions vyper/venom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,23 @@ function global {
selector_bucket_0:
%3 = xor %2, 1579456981
%4 = iszero %3
jnz @1, @2, %4
jnz %4, @true, @false

1:
false:
jmp @fallback

2:
true:
%5 = callvalue
%6 = calldatasize
%7 = lt %6, 164
%8 = or %5, %7
%7 = lt 164, %6
%8 = or %7, %5
%9 = iszero %8
assert %9
stop

fallback:
revert 0, 0
}

[data]
```

### Grammar
Expand Down Expand Up @@ -233,7 +231,7 @@ Assembly can be inspected with `-f asm`, whereas an opcode view of the final byt
`PUSH1 12 PUSH1 24 _mem_deploy_end ADD MSTORE`.
- `phi`
- ```
out = phi %var_a, label_a, %var_b, label_b
out = phi label_a, %var_a, label_b, %var_b
```
- Because in SSA form each variable is assigned just once, it is tricky to handle that variables may be assigned to something different based on which program path was taken.
- Therefore, we use `phi` instructions. They are are magic instructions, used in basic blocks where the control flow path merges.
Expand Down Expand Up @@ -361,14 +359,14 @@ Assembly can be inspected with `-f asm`, whereas an opcode view of the final byt
- Translates to `label JUMP`.
- `jnz`
- ```
jnz label1, label2, op
jnz op, label1, label2
```
- A conditional jump depending on the value of `op`.
- Jumps to `label2` when `op` is not zero, otherwise jumps to `label1`.
- For example
```
%op = 15
jnz label1, label2, %op
jnz %op, @label1, @label2
```
could translate to: `PUSH1 15 label2 JUMPI label1 JUMP`.
- `djmp`
Expand Down
Loading