Refine codes and fix several issues (#882)

Refine some codes in wasm loader
Add -Wshadow to gcc compile flags and fix some variable shadowed issues
Fix function parameter/return types not checked issue
Fix fast-interp loader reserve_block_ret() not handle V128 return type issue
Fix mini loader load_table_segment_section() failed issue
Add detailed comments for argc argument in wasm_runtime_call_wasm()
This commit is contained in:
Wenyong Huang
2021-12-10 18:13:17 +08:00
committed by GitHub
parent 915b26b0ec
commit 5547924e28
13 changed files with 273 additions and 289 deletions

View File

@ -520,6 +520,8 @@ wasm_value_type_size(uint8 value_type)
case VALUE_TYPE_V128:
return sizeof(int64) * 2;
#endif
case VALUE_TYPE_VOID:
return 0;
default:
bh_assert(0);
}
@ -529,25 +531,7 @@ wasm_value_type_size(uint8 value_type)
inline static uint16
wasm_value_type_cell_num(uint8 value_type)
{
if (value_type == VALUE_TYPE_VOID)
return 0;
else if (value_type == VALUE_TYPE_I32 || value_type == VALUE_TYPE_F32
#if WASM_ENABLE_REF_TYPES != 0
|| value_type == VALUE_TYPE_FUNCREF
|| value_type == VALUE_TYPE_EXTERNREF
#endif
)
return 1;
else if (value_type == VALUE_TYPE_I64 || value_type == VALUE_TYPE_F64)
return 2;
#if WASM_ENABLE_SIMD != 0
else if (value_type == VALUE_TYPE_V128)
return 4;
#endif
else {
bh_assert(0);
}
return 0;
return wasm_value_type_size(value_type) / 4;
}
inline static uint32