@@ -2919,7 +2919,8 @@ load_tag_import(const uint8 **p_buf, const uint8 *buf_end,
2919
2919
goto fail;
2920
2920
}
2921
2921
2922
- WASMType *declare_tag_type = parent_module->types[declare_type_index];
2922
+ WASMFuncType *declare_tag_type =
2923
+ (WASMFuncType *)parent_module->types[declare_type_index];
2923
2924
2924
2925
/* check, that the type of the declared tag returns void */
2925
2926
if (declare_tag_type->result_count != 0) {
@@ -4806,7 +4807,7 @@ load_tag_section(const uint8 *buf, const uint8 *buf_end, const uint8 *buf_code,
4806
4807
4807
4808
/* get return type (must be 0) */
4808
4809
/* check, that the type of the referred tag returns void */
4809
- WASMType *func_type = (WASMType *)module->types[tag_type];
4810
+ WASMFuncType *func_type = (WASMFuncType *)module->types[tag_type];
4810
4811
if (func_type->result_count != 0) {
4811
4812
set_error_buf(error_buf, error_buf_size,
4812
4813
"non-empty tag result type");
@@ -11122,7 +11123,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
11122
11123
11123
11124
/* the tag_type is stored in either the WASMTag (section tags)
11124
11125
* or WASMTagImport (import tag) */
11125
- WASMType *tag_type = NULL;
11126
+ WASMFuncType *tag_type = NULL;
11126
11127
if (tag_index < module->import_tag_count) {
11127
11128
tag_type = module->import_tags[tag_index].u.tag.tag_type;
11128
11129
}
@@ -11145,11 +11146,36 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
11145
11146
/* Check stack values match return types by comparing tag param
11146
11147
* types with stack cells */
11147
11148
uint8 *frame_ref = loader_ctx->frame_ref;
11149
+ #if WASM_ENABLE_GC != 0
11150
+ WASMRefTypeMap *frame_reftype_map =
11151
+ loader_ctx->frame_reftype_map;
11152
+ uint32 frame_reftype_map_num = loader_ctx->reftype_map_num;
11153
+ param_reftype_maps = tag_type->ref_type_maps;
11154
+ /* For tag_type function, it shouldn't have result_count = 0 */
11155
+ param_reftype_map_count = tag_type->ref_type_map_count;
11156
+ param_count = (int32)tag_type->param_count;
11157
+ #endif
11158
+
11148
11159
for (int tti = (int32)tag_type->param_count - 1; tti >= 0;
11149
11160
tti--) {
11161
+ #if WASM_ENABLE_GC != 0
11162
+ local_type = tag_type->types[tti];
11163
+ local_idx = tti;
11164
+ /* Get the wasm_ref_type if the local_type is multibyte
11165
+ * type */
11166
+ GET_LOCAL_REFTYPE();
11167
+ #endif
11168
+
11150
11169
if (!check_stack_top_values(
11151
11170
loader_ctx, frame_ref, available_stack_cell,
11152
- tag_type->types[tti], error_buf, error_buf_size)) {
11171
+ #if WASM_ENABLE_GC != 0
11172
+ frame_reftype_map, frame_reftype_map_num,
11173
+ #endif
11174
+ tag_type->types[tti],
11175
+ #if WASM_ENABLE_GC != 0
11176
+ &wasm_ref_type,
11177
+ #endif
11178
+ error_buf, error_buf_size)) {
11153
11179
snprintf(error_buf, error_buf_size,
11154
11180
"type mismatch: instruction requires [%s] but "
11155
11181
"stack has [%s]",
@@ -11232,7 +11258,7 @@ wasm_loader_prepare_bytecode(WASMModule *module, WASMFunction *func,
11232
11258
11233
11259
/* the tag_type is stored in either the WASMTag (section tags)
11234
11260
* or WASMTagImport (import tag) */
11235
- WASMType *func_type = NULL;
11261
+ WASMFuncType *func_type = NULL;
11236
11262
if (tag_index < module->import_tag_count) {
11237
11263
func_type = module->import_tags[tag_index].u.tag.tag_type;
11238
11264
}
0 commit comments