@@ -334,8 +334,10 @@ is_packed_type(uint8 type)
334334static bool
335335is_byte_a_type(uint8 type)
336336{
337- return (is_valid_value_type(type) || (type == VALUE_TYPE_VOID)) ? true
338- : false;
337+ return (is_valid_value_type_for_interpreter(type)
338+ || (type == VALUE_TYPE_VOID))
339+ ? true
340+ : false;
339341}
340342
341343#if WASM_ENABLE_SIMD != 0
@@ -1443,7 +1445,7 @@ resolve_value_type(const uint8 **p_buf, const uint8 *buf_end,
14431445 }
14441446 else {
14451447 /* type which can be represented by one byte */
1446- if (!is_valid_value_type (type)
1448+ if (!is_valid_value_type_for_interpreter (type)
14471449 && !(allow_packed_type && is_packed_type(type))) {
14481450 set_error_buf(error_buf, error_buf_size, "type mismatch");
14491451 return false;
@@ -1953,7 +1955,7 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
19531955 type->types[param_count + j] = read_uint8(p);
19541956 }
19551957 for (j = 0; j < param_count + result_count; j++) {
1956- if (!is_valid_value_type (type->types[j])) {
1958+ if (!is_valid_value_type_for_interpreter (type->types[j])) {
19571959 set_error_buf(error_buf, error_buf_size,
19581960 "unknown value type");
19591961 return false;
@@ -3049,7 +3051,7 @@ load_global_import(const uint8 **p_buf, const uint8 *buf_end,
30493051 CHECK_BUF(p, p_end, 2);
30503052 /* global type */
30513053 declare_type = read_uint8(p);
3052- if (!is_valid_value_type (declare_type)) {
3054+ if (!is_valid_value_type_for_interpreter (declare_type)) {
30533055 set_error_buf(error_buf, error_buf_size, "type mismatch");
30543056 return false;
30553057 }
@@ -3766,7 +3768,7 @@ load_function_section(const uint8 *buf, const uint8 *buf_end,
37663768 CHECK_BUF(p_code, buf_code_end, 1);
37673769 /* 0x7F/0x7E/0x7D/0x7C */
37683770 type = read_uint8(p_code);
3769- if (!is_valid_value_type (type)) {
3771+ if (!is_valid_value_type_for_interpreter (type)) {
37703772 if (type == VALUE_TYPE_V128)
37713773 set_error_buf(error_buf, error_buf_size,
37723774 "v128 value type requires simd feature");
@@ -4046,7 +4048,7 @@ load_global_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
40464048 CHECK_BUF(p, p_end, 2);
40474049 /* global type */
40484050 global->type.val_type = read_uint8(p);
4049- if (!is_valid_value_type (global->type.val_type)) {
4051+ if (!is_valid_value_type_for_interpreter (global->type.val_type)) {
40504052 set_error_buf(error_buf, error_buf_size, "type mismatch");
40514053 return false;
40524054 }
@@ -12367,7 +12369,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
1236712369#if WASM_ENABLE_GC == 0
1236812370 CHECK_BUF(p, p_end, 1);
1236912371 type = read_uint8(p);
12370- if (!is_valid_value_type (type)) {
12372+ if (!is_valid_value_type_for_interpreter (type)) {
1237112373 set_error_buf(error_buf, error_buf_size,
1237212374 "unknown value type");
1237312375 goto fail;
0 commit comments