Skip to content

Commit ad6e051

Browse files
committed
Synchronize the GC spec tests to the commit from December 9. 2024.
Revise the error messages to be consistent with the spec test cases.
1 parent 53da420 commit ad6e051

File tree

8 files changed

+475
-585
lines changed

8 files changed

+475
-585
lines changed

core/iwasm/common/wasm_runtime_common.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3014,17 +3014,17 @@ static const char *exception_msgs[] = {
30143014
"wasm operand stack overflow", /* EXCE_OPERAND_STACK_OVERFLOW */
30153015
"failed to compile fast jit function", /* EXCE_FAILED_TO_COMPILE_FAST_JIT_FUNC */
30163016
/* GC related exceptions */
3017-
"null function object", /* EXCE_NULL_FUNC_OBJ */
3018-
"null structure object", /* EXCE_NULL_STRUCT_OBJ */
3019-
"null array reference", /* EXCE_NULL_ARRAY_OBJ */
3017+
"null function reference", /* EXCE_NULL_FUNC_OBJ */
3018+
"null structure reference", /* EXCE_NULL_STRUCT_OBJ */
3019+
"null array reference", /* EXCE_NULL_ARRAY_OBJ */
30203020
"null i31 reference", /* EXCE_NULL_I31_OBJ */
30213021
"null reference", /* EXCE_NULL_REFERENCE */
30223022
"create rtt type failed", /* EXCE_FAILED_TO_CREATE_RTT_TYPE */
30233023
"create struct object failed", /* EXCE_FAILED_TO_CREATE_STRUCT_OBJ */
30243024
"create array object failed", /* EXCE_FAILED_TO_CREATE_ARRAY_OBJ */
30253025
"create externref object failed", /* EXCE_FAILED_TO_CREATE_EXTERNREF_OBJ */
30263026
"cast failure", /* EXCE_CAST_FAILURE */
3027-
"out of bounds array access", /* EXCE_ARRAY_IDX_OOB */
3027+
"out of bounds array access", /* EXCE_ARRAY_IDX_OOB */
30283028
/* stringref related exceptions */
30293029
"create string object failed", /* EXCE_FAILED_TO_CREATE_STRING */
30303030
"create stringref failed", /* EXCE_FAILED_TO_CREATE_STRINGREF */

core/iwasm/interpreter/wasm_interp_classic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
26492649
read_leb_uint32(frame_ip, frame_ip_end, type_index);
26502650
func_obj = POP_REF();
26512651
if (!func_obj) {
2652-
wasm_set_exception(module, "null function object");
2652+
wasm_set_exception(module, "null function reference");
26532653
goto got_exception;
26542654
}
26552655

@@ -2666,7 +2666,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
26662666
read_leb_uint32(frame_ip, frame_ip_end, type_index);
26672667
func_obj = POP_REF();
26682668
if (!func_obj) {
2669-
wasm_set_exception(module, "null function object");
2669+
wasm_set_exception(module, "null function reference");
26702670
goto got_exception;
26712671
}
26722672

@@ -2813,7 +2813,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
28132813
struct_obj = POP_REF();
28142814

28152815
if (!struct_obj) {
2816-
wasm_set_exception(module, "null structure object");
2816+
wasm_set_exception(module, "null structure reference");
28172817
goto got_exception;
28182818
}
28192819

@@ -2869,7 +2869,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
28692869

28702870
struct_obj = POP_REF();
28712871
if (!struct_obj) {
2872-
wasm_set_exception(module, "null structure object");
2872+
wasm_set_exception(module, "null structure reference");
28732873
goto got_exception;
28742874
}
28752875

core/iwasm/interpreter/wasm_interp_fast.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
19921992
#endif
19931993
func_obj = POP_REF();
19941994
if (!func_obj) {
1995-
wasm_set_exception(module, "null function object");
1995+
wasm_set_exception(module, "null function reference");
19961996
goto got_exception;
19971997
}
19981998

@@ -2007,7 +2007,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
20072007
#endif
20082008
func_obj = POP_REF();
20092009
if (!func_obj) {
2010-
wasm_set_exception(module, "null function object");
2010+
wasm_set_exception(module, "null function reference");
20112011
goto got_exception;
20122012
}
20132013

@@ -2148,7 +2148,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
21482148
struct_obj = POP_REF();
21492149

21502150
if (!struct_obj) {
2151-
wasm_set_exception(module, "null structure object");
2151+
wasm_set_exception(module, "null structure reference");
21522152
goto got_exception;
21532153
}
21542154

@@ -2204,7 +2204,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
22042204

22052205
struct_obj = POP_REF();
22062206
if (!struct_obj) {
2207-
wasm_set_exception(module, "null structure object");
2207+
wasm_set_exception(module, "null structure reference");
22082208
goto got_exception;
22092209
}
22102210

core/iwasm/interpreter/wasm_loader.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2135,8 +2135,9 @@ load_type_section(const uint8 *buf, const uint8 *buf_end, WASMModule *module,
21352135
if (!wasm_type_is_subtype_of(cur_type, parent_type,
21362136
module->types,
21372137
module->type_count)) {
2138-
set_error_buf(error_buf, error_buf_size,
2139-
"sub type does not match super type");
2138+
set_error_buf_v(error_buf, error_buf_size,
2139+
"sub type %u does not match super type",
2140+
processed_type_count + j);
21402141
return false;
21412142
}
21422143
}

core/iwasm/interpreter/wasm_runtime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4660,7 +4660,7 @@ llvm_jit_table_init(WASMModuleInstance *module_inst, uint32 tbl_idx,
46604660
if (!(func_obj = wasm_create_func_obj(module_inst,
46614661
init_values[i].u.ref_index,
46624662
true, NULL, 0))) {
4663-
wasm_set_exception(module_inst, "null function object");
4663+
wasm_set_exception(module_inst, "null function reference");
46644664
return;
46654665
}
46664666
table_elems[i] = func_obj;

tests/wamr-test-suites/spec-test-script/all.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ def ignore_the_case(
100100
return True
101101

102102
if gc_flag:
103-
if case_name in ["array_init_elem", "array_init_data"]:
103+
if case_name in [
104+
"array_init_elem",
105+
"array_init_data",
106+
"array_new_data",
107+
"array_new_elem"
108+
]:
104109
return True
105110

106111
if sgx_flag:

0 commit comments

Comments
 (0)