diff options
author | Ben Smith <binji@chromium.org> | 2016-10-24 13:44:13 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-10-26 10:16:25 -0700 |
commit | c034df96ff86d5731e3eff0f71bb2d96f7a37305 (patch) | |
tree | f1fda5beb9711bb94b6ed8760cf36daaeade8d67 /src/wasm-binary-reader.c | |
parent | 4ec57d83d7869c3f96922debbe0b1e637d1fa2f8 (diff) | |
download | wabt-c034df96ff86d5731e3eff0f71bb2d96f7a37305.tar.gz wabt-c034df96ff86d5731e3eff0f71bb2d96f7a37305.tar.bz2 wabt-c034df96ff86d5731e3eff0f71bb2d96f7a37305.zip |
Add reserved immediate to three operators
call_indirect, grow_memory and current_memory all take an additional
immediate which must be zero. After the MVP, this will be used to allow
specifying a table or memory index.
Diffstat (limited to 'src/wasm-binary-reader.c')
-rw-r--r-- | src/wasm-binary-reader.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/wasm-binary-reader.c b/src/wasm-binary-reader.c index 81cb0ea2..fa3fec86 100644 --- a/src/wasm-binary-reader.c +++ b/src/wasm-binary-reader.c @@ -1445,8 +1445,12 @@ static void read_function_body(Context* ctx, in_u32_leb128(ctx, &sig_index, "call_indirect signature index"); RAISE_ERROR_UNLESS(sig_index < ctx->num_signatures, "invalid call_indirect signature index"); + uint32_t reserved; + in_u32_leb128(ctx, &reserved, "call_indirect reserved"); + RAISE_ERROR_UNLESS(reserved == 0, + "call_indirect reserved value must be 0"); CALLBACK(on_call_indirect_expr, sig_index); - CALLBACK_CTX(on_opcode_uint32, sig_index); + CALLBACK_CTX(on_opcode_uint32_uint32, sig_index, reserved); break; } @@ -1501,15 +1505,25 @@ static void read_function_body(Context* ctx, break; } - case WASM_OPCODE_CURRENT_MEMORY: + case WASM_OPCODE_CURRENT_MEMORY: { + uint32_t reserved; + in_u32_leb128(ctx, &reserved, "current_memory reserved"); + RAISE_ERROR_UNLESS(reserved == 0, + "current_memory reserved value must be 0"); CALLBACK0(on_current_memory_expr); - CALLBACK_CTX0(on_opcode_bare); + CALLBACK_CTX(on_opcode_uint32, reserved); break; + } - case WASM_OPCODE_GROW_MEMORY: + case WASM_OPCODE_GROW_MEMORY: { + uint32_t reserved; + in_u32_leb128(ctx, &reserved, "grow_memory reserved"); + RAISE_ERROR_UNLESS(reserved == 0, + "grow_memory reserved value must be 0"); CALLBACK0(on_grow_memory_expr); - CALLBACK_CTX0(on_opcode_bare); + CALLBACK_CTX(on_opcode_uint32, reserved); break; + } case WASM_OPCODE_I32_ADD: case WASM_OPCODE_I32_SUB: |