Skip to content

Commit

Permalink
Fix block with type issue in fast interp (bytecodealliance#2866)
Browse files Browse the repository at this point in the history
  • Loading branch information
xujuntwt95329 authored Dec 5, 2023
1 parent 23c1343 commit 53c3fa2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions core/iwasm/interpreter/wasm_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -7199,19 +7199,18 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
}

#if WASM_ENABLE_FAST_INTERP != 0
if (opcode == WASM_OP_BLOCK) {
skip_label();
}
else if (opcode == WASM_OP_LOOP) {
if (opcode == WASM_OP_BLOCK || opcode == WASM_OP_LOOP) {
skip_label();
if (BLOCK_HAS_PARAM(block_type)) {
/* Make sure params are in dynamic space */
if (!copy_params_to_dynamic_space(
loader_ctx, false, error_buf, error_buf_size))
goto fail;
}
(loader_ctx->frame_csp - 1)->code_compiled =
loader_ctx->p_code_compiled;
if (opcode == WASM_OP_LOOP) {
(loader_ctx->frame_csp - 1)->code_compiled =
loader_ctx->p_code_compiled;
}
}
else if (opcode == WASM_OP_IF) {
/* If block has parameters, we should make sure they are in
Expand Down
11 changes: 5 additions & 6 deletions core/iwasm/interpreter/wasm_mini_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -5627,19 +5627,18 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
}

#if WASM_ENABLE_FAST_INTERP != 0
if (opcode == WASM_OP_BLOCK) {
skip_label();
}
else if (opcode == WASM_OP_LOOP) {
if (opcode == WASM_OP_BLOCK || opcode == WASM_OP_LOOP) {
skip_label();
if (BLOCK_HAS_PARAM(block_type)) {
/* Make sure params are in dynamic space */
if (!copy_params_to_dynamic_space(
loader_ctx, false, error_buf, error_buf_size))
goto fail;
}
(loader_ctx->frame_csp - 1)->code_compiled =
loader_ctx->p_code_compiled;
if (opcode == WASM_OP_LOOP) {
(loader_ctx->frame_csp - 1)->code_compiled =
loader_ctx->p_code_compiled;
}
}
else if (opcode == WASM_OP_IF) {
/* If block has parameters, we should make sure they are in
Expand Down

0 comments on commit 53c3fa2

Please sign in to comment.