@@ -65,6 +65,9 @@ extern "C" {
65
65
#if WASM_ENABLE_BULK_MEMORY != 0
66
66
#define SECTION_TYPE_DATACOUNT 12
67
67
#endif
68
+ #if WASM_ENABLE_TAGS != 0
69
+ #define SECTION_TYPE_TAG 13
70
+ #endif
68
71
69
72
#define SUB_SECTION_TYPE_MODULE 0
70
73
#define SUB_SECTION_TYPE_FUNC 1
@@ -74,20 +77,34 @@ extern "C" {
74
77
#define IMPORT_KIND_TABLE 1
75
78
#define IMPORT_KIND_MEMORY 2
76
79
#define IMPORT_KIND_GLOBAL 3
80
+ #if WASM_ENABLE_TAGS != 0
81
+ #define IMPORT_KIND_TAG 4
82
+ #endif
77
83
78
84
#define EXPORT_KIND_FUNC 0
79
85
#define EXPORT_KIND_TABLE 1
80
86
#define EXPORT_KIND_MEMORY 2
81
87
#define EXPORT_KIND_GLOBAL 3
88
+ #if WASM_ENABLE_TAGS != 0
89
+ #define EXPORT_KIND_TAG 4
90
+ #endif
82
91
83
92
#define LABEL_TYPE_BLOCK 0
84
93
#define LABEL_TYPE_LOOP 1
85
94
#define LABEL_TYPE_IF 2
86
95
#define LABEL_TYPE_FUNCTION 3
96
+ #if WASM_ENABLE_EXCE_HANDLING != 0
97
+ #define LABEL_TYPE_TRY 4
98
+ #define LABEL_TYPE_CATCH 5
99
+ #define LABEL_TYPE_CATCH_ALL 6
100
+ #endif
87
101
88
102
typedef struct WASMModule WASMModule ;
89
103
typedef struct WASMFunction WASMFunction ;
90
104
typedef struct WASMGlobal WASMGlobal ;
105
+ #if WASM_ENABLE_TAGS != 0
106
+ typedef struct WASMTag WASMTag ;
107
+ #endif
91
108
92
109
typedef union V128 {
93
110
int8 i8x16 [16 ];
@@ -201,6 +218,24 @@ typedef struct WASMFunctionImport {
201
218
bool call_conv_wasm_c_api ;
202
219
} WASMFunctionImport ;
203
220
221
+ #if WASM_ENABLE_TAGS != 0
222
+ typedef struct WASMTagImport {
223
+ char * module_name ;
224
+ char * field_name ;
225
+ uint8 attribute ; /* the type of the tag (numerical) */
226
+ uint32 type ; /* the type of the catch function (numerical)*/
227
+ WASMType * tag_type ;
228
+ void * tag_ptr_linked ;
229
+
230
+ #if WASM_ENABLE_MULTI_MODULE != 0
231
+ /* imported tag pointer after linked */
232
+ WASMModule * import_module ;
233
+ WASMTag * import_tag_linked ;
234
+ uint32 import_tag_index_linked ;
235
+ #endif
236
+ } WASMTagImport ;
237
+ #endif
238
+
204
239
typedef struct WASMGlobalImport {
205
240
char * module_name ;
206
241
char * field_name ;
@@ -227,6 +262,9 @@ typedef struct WASMImport {
227
262
WASMFunctionImport function ;
228
263
WASMTableImport table ;
229
264
WASMMemoryImport memory ;
265
+ #if WASM_ENABLE_TAGS != 0
266
+ WASMTagImport tag ;
267
+ #endif
230
268
WASMGlobalImport global ;
231
269
struct {
232
270
char * module_name ;
@@ -265,6 +303,10 @@ struct WASMFunction {
265
303
uint32 const_cell_num ;
266
304
#endif
267
305
306
+ #if WASM_ENABLE_EXCE_HANDLING != 0
307
+ uint32 exception_handler_count ;
308
+ #endif
309
+
268
310
#if WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
269
311
|| WASM_ENABLE_WAMR_COMPILER != 0
270
312
/* Whether function has opcode memory.grow */
@@ -294,6 +336,14 @@ struct WASMFunction {
294
336
#endif
295
337
};
296
338
339
+ #if WASM_ENABLE_TAGS != 0
340
+ struct WASMTag {
341
+ uint8 attribute ; /* the attribute property of the tag (expected to be 0) */
342
+ uint32 type ; /* the type of the tag (expected valid inden in type table) */
343
+ WASMType * tag_type ;
344
+ };
345
+ #endif
346
+
297
347
struct WASMGlobal {
298
348
uint8 type ;
299
349
bool is_mutable ;
@@ -420,6 +470,9 @@ struct WASMModule {
420
470
uint32 function_count ;
421
471
uint32 table_count ;
422
472
uint32 memory_count ;
473
+ #if WASM_ENABLE_TAGS != 0
474
+ uint32 tag_count ;
475
+ #endif
423
476
uint32 global_count ;
424
477
uint32 export_count ;
425
478
uint32 table_seg_count ;
@@ -433,18 +486,27 @@ struct WASMModule {
433
486
uint32 import_function_count ;
434
487
uint32 import_table_count ;
435
488
uint32 import_memory_count ;
489
+ #if WASM_ENABLE_TAGS != 0
490
+ uint32 import_tag_count ;
491
+ #endif
436
492
uint32 import_global_count ;
437
493
438
494
WASMImport * import_functions ;
439
495
WASMImport * import_tables ;
440
496
WASMImport * import_memories ;
497
+ #if WASM_ENABLE_TAGS != 0
498
+ WASMImport * import_tags ;
499
+ #endif
441
500
WASMImport * import_globals ;
442
501
443
502
WASMType * * types ;
444
503
WASMImport * imports ;
445
504
WASMFunction * * functions ;
446
505
WASMTable * tables ;
447
506
WASMMemory * memories ;
507
+ #if WASM_ENABLE_TAGS != 0
508
+ WASMTag * * tags ;
509
+ #endif
448
510
WASMGlobal * globals ;
449
511
WASMExport * exports ;
450
512
WASMTableSeg * table_segments ;
@@ -628,6 +690,11 @@ typedef struct WASMBranchBlock {
628
690
uint8 * target_addr ;
629
691
uint32 * frame_sp ;
630
692
uint32 cell_num ;
693
+ #if WASM_ENABLE_EXCE_HANDLING != 0
694
+ /* in exception handling, label_type needs to be stored to lookup exception
695
+ * handlers */
696
+ uint8 label_type ;
697
+ #endif
631
698
} WASMBranchBlock ;
632
699
633
700
/**
0 commit comments