@@ -324,18 +324,20 @@ It is legal to have several entries with the same type.
324
324
| Name | Opcode | Immediate | Description |
325
325
| ---- | ---- | ---- | ---- |
326
326
| ` nop ` | ` 0x00 ` | | no operation |
327
- | ` block ` | ` 0x01 ` | count = ` varuint32 ` | a sequence of expressions, the last of which yields a value |
328
- | ` loop ` | ` 0x02 ` | count = ` varuint32 ` | a block which can also form control flow loops |
329
- | ` if ` | ` 0x03 ` | | high-level one-armed if |
330
- | ` if_else ` | ` 0x04 ` | | high-level two-armed if |
327
+ | ` block ` | ` 0x01 ` | | begin a sequence of expressions, the last of which yields a value |
328
+ | ` loop ` | ` 0x02 ` | | begin a block which can also form control flow loops |
329
+ | ` if ` | ` 0x03 ` | | begin if expression |
330
+ | ` else ` | ` 0x04 ` | | begin else expression of if |
331
331
| ` select ` | ` 0x05 ` | | select one of two values based on condition |
332
332
| ` br ` | ` 0x06 ` | relative_depth = ` varuint32 ` | break that targets a outer nested block |
333
333
| ` br_if ` | ` 0x07 ` | relative_depth = ` varuint32 ` | conditional break that targets a outer nested block |
334
334
| ` br_table ` | ` 0x08 ` | see below | branch table control flow construct |
335
- | ` return ` | ` 0x14 ` | | return zero or one value from this function |
336
- | ` unreachable ` | ` 0x15 ` | | trap immediately |
335
+ | ` return ` | ` 0x09 ` | | return zero or one value from this function |
336
+ | ` unreachable ` | ` 0x0a ` | | trap immediately |
337
+ | ` end ` | ` 0x0f ` | | end a block, loop, or if |
337
338
338
339
The ` br_table ` operator has an immediate operand which is encoded as follows:
340
+ Note that there is no explicit ` if_else ` opcode, as the else clause is encoded with the ` else ` bytecode.
339
341
340
342
| Field | Type | Description |
341
343
| ---- | ---- | ---- |
@@ -350,15 +352,15 @@ out of range, `br_table` branches to the default target.
350
352
## Basic operators ([ described here] ( AstSemantics.md#constants ) )
351
353
| Name | Opcode | Immediate | Description |
352
354
| ---- | ---- | ---- | ---- |
353
- | ` i32.const ` | ` 0x0a ` | value = ` varint32 ` | a constant value interpreted as ` i32 ` |
354
- | ` i64.const ` | ` 0x0b ` | value = ` varint64 ` | a constant value interpreted as ` i64 ` |
355
- | ` f64.const ` | ` 0x0c ` | value = ` uint64 ` | a constant value interpreted as ` f64 ` |
356
- | ` f32.const ` | ` 0x0d ` | value = ` uint32 ` | a constant value interpreted as ` f32 ` |
357
- | ` get_local ` | ` 0x0e ` | local_index = ` varuint32 ` | read a local variable or parameter |
358
- | ` set_local ` | ` 0x0f ` | local_index = ` varuint32 ` | write a local variable or parameter |
359
- | ` call ` | ` 0x12 ` | function_index = ` varuint32 ` | call a function by its index |
360
- | ` call_indirect ` | ` 0x13 ` | signature_index = ` varuint32 ` | call a function indirect with an expected signature |
361
- | ` call_import ` | ` 0x1f ` | import_index = ` varuint32 ` | call an imported function by its index |
355
+ | ` i32.const ` | ` 0x10 ` | value = ` varint32 ` | a constant value interpreted as ` i32 ` |
356
+ | ` i64.const ` | ` 0x11 ` | value = ` varint64 ` | a constant value interpreted as ` i64 ` |
357
+ | ` f64.const ` | ` 0x12 ` | value = ` uint64 ` | a constant value interpreted as ` f64 ` |
358
+ | ` f32.const ` | ` 0x13 ` | value = ` uint32 ` | a constant value interpreted as ` f32 ` |
359
+ | ` get_local ` | ` 0x14 ` | local_index = ` varuint32 ` | read a local variable or parameter |
360
+ | ` set_local ` | ` 0x15 ` | local_index = ` varuint32 ` | write a local variable or parameter |
361
+ | ` call ` | ` 0x16 ` | function_index = ` varuint32 ` | call a function by its index |
362
+ | ` call_indirect ` | ` 0x17 ` | signature_index = ` varuint32 ` | call a function indirect with an expected signature |
363
+ | ` call_import ` | ` 0x18 ` | import_index = ` varuint32 ` | call an imported function by its index |
362
364
363
365
## Memory-related operators ([ described here] ( AstSemantics.md#linear-memory-accesses ) )
364
366
0 commit comments