mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-09 13:16:26 +00:00
Fix wasm loader handle op_br_table and op_drop (#2864)
- Fix op_br_table arity type check when the dest block is loop block - Fix op_drop issue when the stack is polymorphic and it is to drop an ANY type value in the stack
This commit is contained in:
parent
7308b1eb00
commit
23c1343fb3
|
@ -7451,6 +7451,9 @@ re_scan:
|
||||||
if (frame_csp_tmp->label_type != LABEL_TYPE_LOOP)
|
if (frame_csp_tmp->label_type != LABEL_TYPE_LOOP)
|
||||||
ret_count = block_type_get_result_types(
|
ret_count = block_type_get_result_types(
|
||||||
&frame_csp_tmp->block_type, &ret_types);
|
&frame_csp_tmp->block_type, &ret_types);
|
||||||
|
else
|
||||||
|
ret_count = block_type_get_param_types(
|
||||||
|
&frame_csp_tmp->block_type, &ret_types);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8 *tmp_ret_types = NULL;
|
uint8 *tmp_ret_types = NULL;
|
||||||
|
@ -7461,6 +7464,9 @@ re_scan:
|
||||||
if (frame_csp_tmp->label_type != LABEL_TYPE_LOOP)
|
if (frame_csp_tmp->label_type != LABEL_TYPE_LOOP)
|
||||||
tmp_ret_count = block_type_get_result_types(
|
tmp_ret_count = block_type_get_result_types(
|
||||||
&frame_csp_tmp->block_type, &tmp_ret_types);
|
&frame_csp_tmp->block_type, &tmp_ret_types);
|
||||||
|
else
|
||||||
|
tmp_ret_count = block_type_get_param_types(
|
||||||
|
&frame_csp_tmp->block_type, &tmp_ret_types);
|
||||||
|
|
||||||
if (ret_count != tmp_ret_count
|
if (ret_count != tmp_ret_count
|
||||||
|| (ret_count
|
|| (ret_count
|
||||||
|
@ -7753,7 +7759,8 @@ re_scan:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (available_stack_cell > 0) {
|
if (available_stack_cell > 0) {
|
||||||
if (is_32bit_type(*(loader_ctx->frame_ref - 1))) {
|
if (is_32bit_type(*(loader_ctx->frame_ref - 1))
|
||||||
|
|| *(loader_ctx->frame_ref - 1) == VALUE_TYPE_ANY) {
|
||||||
loader_ctx->frame_ref--;
|
loader_ctx->frame_ref--;
|
||||||
loader_ctx->stack_cell_num--;
|
loader_ctx->stack_cell_num--;
|
||||||
#if WASM_ENABLE_FAST_INTERP != 0
|
#if WASM_ENABLE_FAST_INTERP != 0
|
||||||
|
|
|
@ -6100,7 +6100,8 @@ re_scan:
|
||||||
&& !cur_block->is_stack_polymorphic));
|
&& !cur_block->is_stack_polymorphic));
|
||||||
|
|
||||||
if (available_stack_cell > 0) {
|
if (available_stack_cell > 0) {
|
||||||
if (is_32bit_type(*(loader_ctx->frame_ref - 1))) {
|
if (is_32bit_type(*(loader_ctx->frame_ref - 1))
|
||||||
|
|| *(loader_ctx->frame_ref - 1) == VALUE_TYPE_ANY) {
|
||||||
loader_ctx->frame_ref--;
|
loader_ctx->frame_ref--;
|
||||||
loader_ctx->stack_cell_num--;
|
loader_ctx->stack_cell_num--;
|
||||||
#if WASM_ENABLE_FAST_INTERP != 0
|
#if WASM_ENABLE_FAST_INTERP != 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user