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

Remove arities from call/return #748

Merged
merged 1 commit into from
Aug 16, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 6 additions & 10 deletions BinaryEncoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,17 +444,15 @@ It is legal to have several entries with the same type.
| `if` | `0x03` | | begin if expression |
| `else` | `0x04` | | begin else expression of if |
| `select` | `0x05` | | select one of two values based on condition |
| `br` | `0x06` | argument_count : `varuint1`, relative_depth : `varuint32` | break that targets an outer nested block |
| `br_if` | `0x07` | argument_count : `varuint1`, relative_depth : `varuint32` | conditional break that targets an outer nested block |
| `br` | `0x06` | arity : `varuint1`, relative_depth : `varuint32` | break that targets an outer nested block |
| `br_if` | `0x07` | arity : `varuint1`, relative_depth : `varuint32` | conditional break that targets an outer nested block |
| `br_table` | `0x08` | see below | branch table control flow construct |
| `return` | `0x09` | argument_count : `varuint1` | return zero or one value from this function |
| `return` | `0x09` | return zero or one value from this function |
| `drop` | `0x0b` | | ignore value |
| `nop` | `0x0a` | | no operation |
| `end` | `0x0f` | | end a block, loop, or if |

Note that there is no explicit `if_else` opcode, as the else clause is encoded with the `else` bytecode.

The counts following the break and return operators specify how many preceding operands are taken as transfer arguments; in the MVP, all these values must be either 0 or 1.
The counts following the break operators specify how many operands are taken as transfer arguments; in the MVP, all these values must be either 0 or 1.

The `br_table` operator has an immediate operand which is encoded as follows:

Expand Down Expand Up @@ -483,10 +481,8 @@ out of range, `br_table` branches to the default target.
| `tee_local` | `0x19` | local_index : `varuint32` | write a local variable or parameter and return the same value |
| `get_global` | `0xbb` | global_index : `varuint32` | read a global variable |
| `set_global` | `0xbc` | global_index : `varuint32` | write a global variable |
| `call` | `0x16` | argument_count : `varuint1`, function_index : `varuint32` | call a function by its [index](Modules.md#function-index-space) |
| `call_indirect` | `0x17` | argument_count : `varuint1`, type_index : `varuint32` | call a function indirect with an expected signature |

The counts following the different call opcodes specify the number of preceding operands taken as arguments.
| `call` | `0x16` | function_index : `varuint32` | call a function by its [index](Modules.md#function-index-space) |
| `call_indirect` | `0x17` | type_index : `varuint32` | call a function indirect with an expected signature |

## Memory-related operators ([described here](AstSemantics.md#linear-memory-accesses))

Expand Down