krillplayer-plugin 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. package/LICENSE +2 -1
  2. package/README.md +2 -0
  3. package/dist/cli.js +397 -80
  4. package/dist/crypto.js +38 -11
  5. package/dist/engine/engine.c +6 -3
  6. package/kernel/Sources/CQuickJS/include/kernel_qjs.h +8 -1
  7. package/kernel/Sources/CQuickJS/kernel_internal.h +54 -0
  8. package/kernel/Sources/CQuickJS/kernel_qjs.c +17 -29
  9. package/kernel/Sources/CQuickJS/kernel_wasm.c +1155 -0
  10. package/kernel/Sources/CWAMR/include/kernel_wamr.h +151 -0
  11. package/kernel/Sources/CWAMR/include/kernel_wamr_config.h +66 -0
  12. package/kernel/Sources/CWAMR/vendor/LICENSE +219 -0
  13. package/kernel/Sources/CWAMR/vendor/core/config.h +727 -0
  14. package/kernel/Sources/CWAMR/vendor/core/iwasm/aot/aot_runtime.h +899 -0
  15. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/arch/invokeNative_general.c +123 -0
  16. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_application.c +933 -0
  17. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_blocking_op.c +92 -0
  18. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api.c +5391 -0
  19. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_c_api_internal.h +246 -0
  20. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.c +336 -0
  21. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_exec_env.h +328 -0
  22. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.c +242 -0
  23. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_loader_common.h +62 -0
  24. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.c +1999 -0
  25. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_memory.h +154 -0
  26. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.c +1532 -0
  27. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_native.h +117 -0
  28. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.c +8070 -0
  29. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_runtime_common.h +1396 -0
  30. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.c +477 -0
  31. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_shared_memory.h +63 -0
  32. package/kernel/Sources/CWAMR/vendor/core/iwasm/common/wasm_suspend_flags.h +52 -0
  33. package/kernel/Sources/CWAMR/vendor/core/iwasm/compilation/aot.h +366 -0
  34. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/lib_export.h +60 -0
  35. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_c_api.h +910 -0
  36. package/kernel/Sources/CWAMR/vendor/core/iwasm/include/wasm_export.h +2440 -0
  37. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm.h +1492 -0
  38. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp.h +122 -0
  39. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_interp_fast.c +7998 -0
  40. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.c +16909 -0
  41. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_loader.h +80 -0
  42. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_opcode.h +1043 -0
  43. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.c +5174 -0
  44. package/kernel/Sources/CWAMR/vendor/core/iwasm/interpreter/wasm_runtime.h +912 -0
  45. package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.c +1569 -0
  46. package/kernel/Sources/CWAMR/vendor/core/iwasm/libraries/thread-mgr/thread_manager.h +256 -0
  47. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_alloc.c +1169 -0
  48. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.c +497 -0
  49. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc.h +350 -0
  50. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_gc_internal.h +384 -0
  51. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_hmu.c +95 -0
  52. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/ems/ems_kfc.c +547 -0
  53. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.c +252 -0
  54. package/kernel/Sources/CWAMR/vendor/core/shared/mem-alloc/mem_alloc.h +96 -0
  55. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/memory/mremap.c +12 -0
  56. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_blocking_op.c +70 -0
  57. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_malloc.c +72 -0
  58. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_memmap.c +302 -0
  59. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_sleep.c +20 -0
  60. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_thread.c +784 -0
  61. package/kernel/Sources/CWAMR/vendor/core/shared/platform/common/posix/posix_time.c +28 -0
  62. package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_init.c +43 -0
  63. package/kernel/Sources/CWAMR/vendor/core/shared/platform/darwin/platform_internal.h +126 -0
  64. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_extension.h +1676 -0
  65. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_api_vmcore.h +192 -0
  66. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_common.h +204 -0
  67. package/kernel/Sources/CWAMR/vendor/core/shared/platform/include/platform_wasi_types.h +610 -0
  68. package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_init.c +43 -0
  69. package/kernel/Sources/CWAMR/vendor/core/shared/platform/linux/platform_internal.h +139 -0
  70. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.c +25 -0
  71. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_assert.h +42 -0
  72. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_atomic.h +300 -0
  73. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.c +27 -0
  74. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_bitmap.h +114 -0
  75. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.c +217 -0
  76. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_common.h +83 -0
  77. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.c +339 -0
  78. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_hashmap.h +168 -0
  79. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.c +77 -0
  80. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_leb128.h +30 -0
  81. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.c +111 -0
  82. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_list.h +109 -0
  83. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.c +111 -0
  84. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_log.h +94 -0
  85. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_platform.h +38 -0
  86. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.c +256 -0
  87. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_queue.h +80 -0
  88. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.c +279 -0
  89. package/kernel/Sources/CWAMR/vendor/core/shared/utils/bh_vector.h +126 -0
  90. package/kernel/Sources/CWAMR/vendor/core/shared/utils/gnuc.h +14 -0
  91. package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.c +469 -0
  92. package/kernel/Sources/CWAMR/vendor/core/shared/utils/runtime_timer.h +51 -0
  93. package/kernel/Sources/CWAMR/vendor/core/version.h +24 -0
  94. package/kernel/Sources/CWAMR/wamr_bh_assert.c +98 -0
  95. package/kernel/Sources/CWAMR/wamr_bh_bitmap.c +98 -0
  96. package/kernel/Sources/CWAMR/wamr_bh_common.c +98 -0
  97. package/kernel/Sources/CWAMR/wamr_bh_hashmap.c +98 -0
  98. package/kernel/Sources/CWAMR/wamr_bh_leb128.c +98 -0
  99. package/kernel/Sources/CWAMR/wamr_bh_list.c +98 -0
  100. package/kernel/Sources/CWAMR/wamr_bh_log.c +98 -0
  101. package/kernel/Sources/CWAMR/wamr_bh_queue.c +98 -0
  102. package/kernel/Sources/CWAMR/wamr_bh_vector.c +98 -0
  103. package/kernel/Sources/CWAMR/wamr_ems_alloc.c +98 -0
  104. package/kernel/Sources/CWAMR/wamr_ems_gc.c +98 -0
  105. package/kernel/Sources/CWAMR/wamr_ems_hmu.c +98 -0
  106. package/kernel/Sources/CWAMR/wamr_ems_kfc.c +98 -0
  107. package/kernel/Sources/CWAMR/wamr_invokeNative_general.c +98 -0
  108. package/kernel/Sources/CWAMR/wamr_mem_alloc.c +98 -0
  109. package/kernel/Sources/CWAMR/wamr_mremap.c +98 -0
  110. package/kernel/Sources/CWAMR/wamr_platform_init_darwin.c +100 -0
  111. package/kernel/Sources/CWAMR/wamr_platform_init_linux.c +100 -0
  112. package/kernel/Sources/CWAMR/wamr_posix_blocking_op.c +98 -0
  113. package/kernel/Sources/CWAMR/wamr_posix_malloc.c +98 -0
  114. package/kernel/Sources/CWAMR/wamr_posix_memmap.c +98 -0
  115. package/kernel/Sources/CWAMR/wamr_posix_sleep.c +98 -0
  116. package/kernel/Sources/CWAMR/wamr_posix_thread.c +98 -0
  117. package/kernel/Sources/CWAMR/wamr_posix_time.c +98 -0
  118. package/kernel/Sources/CWAMR/wamr_runtime_timer.c +98 -0
  119. package/kernel/Sources/CWAMR/wamr_thread_manager.c +98 -0
  120. package/kernel/Sources/CWAMR/wamr_wasm_application.c +98 -0
  121. package/kernel/Sources/CWAMR/wamr_wasm_blocking_op.c +98 -0
  122. package/kernel/Sources/CWAMR/wamr_wasm_c_api.c +98 -0
  123. package/kernel/Sources/CWAMR/wamr_wasm_exec_env.c +98 -0
  124. package/kernel/Sources/CWAMR/wamr_wasm_interp_fast.c +98 -0
  125. package/kernel/Sources/CWAMR/wamr_wasm_loader.c +98 -0
  126. package/kernel/Sources/CWAMR/wamr_wasm_loader_common.c +98 -0
  127. package/kernel/Sources/CWAMR/wamr_wasm_memory.c +98 -0
  128. package/kernel/Sources/CWAMR/wamr_wasm_native.c +98 -0
  129. package/kernel/Sources/CWAMR/wamr_wasm_runtime.c +98 -0
  130. package/kernel/Sources/CWAMR/wamr_wasm_runtime_common.c +98 -0
  131. package/kernel/Sources/CWAMR/wamr_wasm_shared_memory.c +98 -0
  132. package/kernel/Sources/Kernel/PluginPrelude.js +5 -2
  133. package/kernel/Tests/KernelTests/CasePins.js +50 -0
  134. package/package.json +2 -2
  135. package/skill/krillplayer-plugin/SKILL.md +2 -0
  136. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-content-rejected.json +8 -4
  137. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-login-expired.json +8 -4
  138. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-muted.json +8 -4
  139. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-other.json +8 -4
  140. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-rate-limited.json +8 -4
  141. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/danmaku-send-sent.json +8 -4
  142. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-logged-in.json +39 -0
  143. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-backup-line.json +46 -0
  144. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live-selected-line-gone.json +46 -0
  145. package/skill/krillplayer-plugin/assets/samples/live-video-platform/cases/play-live.json +21 -1
  146. package/skill/krillplayer-plugin/assets/samples/live-video-platform/plugin.ts +39 -4
  147. package/skill/krillplayer-plugin/references/cases.md +20 -2
  148. package/skill/krillplayer-plugin/references/contract.d.ts +114 -12
  149. package/skill/krillplayer-plugin/references/crypto-tools.md +104 -0
  150. package/skill/krillplayer-plugin/references/errors-and-fixes.md +5 -1
@@ -0,0 +1,899 @@
1
+ /*
2
+ * Copyright (C) 2019 Intel Corporation. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4
+ */
5
+
6
+ #ifndef _AOT_RUNTIME_H_
7
+ #define _AOT_RUNTIME_H_
8
+
9
+ #include "bh_platform.h"
10
+ #include "../common/wasm_runtime_common.h"
11
+ #include "../interpreter/wasm_runtime.h"
12
+ #include "../compilation/aot.h"
13
+ #if WASM_ENABLE_GC != 0
14
+ #include "gc_export.h"
15
+ #endif
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ /* Wasm feature supported, mainly used by AOTTargetInfo now */
22
+ #define WASM_FEATURE_SIMD_128BIT (1 << 0)
23
+ #define WASM_FEATURE_BULK_MEMORY (1 << 1)
24
+ #define WASM_FEATURE_MULTI_THREAD (1 << 2)
25
+ #define WASM_FEATURE_REF_TYPES (1 << 3)
26
+ #define WASM_FEATURE_GARBAGE_COLLECTION (1 << 4)
27
+ #define WASM_FEATURE_EXCEPTION_HANDLING (1 << 5)
28
+ #define WASM_FEATURE_TINY_STACK_FRAME (1 << 6)
29
+ #define WASM_FEATURE_MULTI_MEMORY (1 << 7)
30
+ #define WASM_FEATURE_DYNAMIC_LINKING (1 << 8)
31
+ #define WASM_FEATURE_COMPONENT_MODEL (1 << 9)
32
+ #define WASM_FEATURE_RELAXED_SIMD (1 << 10)
33
+ #define WASM_FEATURE_FLEXIBLE_VECTORS (1 << 11)
34
+ /* Stack frame is created at the beginning of the function,
35
+ * and not at the beginning of each function call */
36
+ #define WASM_FEATURE_FRAME_PER_FUNCTION (1 << 12)
37
+ #define WASM_FEATURE_FRAME_NO_FUNC_IDX (1 << 13)
38
+
39
+ typedef enum AOTSectionType {
40
+ AOT_SECTION_TYPE_TARGET_INFO = 0,
41
+ AOT_SECTION_TYPE_INIT_DATA = 1,
42
+ AOT_SECTION_TYPE_TEXT = 2,
43
+ AOT_SECTION_TYPE_FUNCTION = 3,
44
+ AOT_SECTION_TYPE_EXPORT = 4,
45
+ AOT_SECTION_TYPE_RELOCATION = 5,
46
+ /*
47
+ * Note: We haven't had anything to use AOT_SECTION_TYPE_SIGNATURE.
48
+ * It's just reserved for possible module signing features.
49
+ */
50
+ AOT_SECTION_TYPE_SIGNATURE = 6,
51
+ AOT_SECTION_TYPE_CUSTOM = 100,
52
+ } AOTSectionType;
53
+
54
+ typedef enum AOTCustomSectionType {
55
+ AOT_CUSTOM_SECTION_RAW = 0,
56
+ AOT_CUSTOM_SECTION_NATIVE_SYMBOL = 1,
57
+ AOT_CUSTOM_SECTION_ACCESS_CONTROL = 2,
58
+ AOT_CUSTOM_SECTION_NAME = 3,
59
+ AOT_CUSTOM_SECTION_STRING_LITERAL = 4,
60
+ } AOTCustomSectionType;
61
+
62
+ typedef struct AOTObjectDataSection {
63
+ char *name;
64
+ uint8 *data;
65
+ uint32 size;
66
+ #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
67
+ bool is_name_allocated;
68
+ bool is_data_allocated;
69
+ #endif
70
+ } AOTObjectDataSection;
71
+
72
+ /* Relocation info */
73
+ typedef struct AOTRelocation {
74
+ uint64 relocation_offset;
75
+ int64 relocation_addend;
76
+ uint32 relocation_type;
77
+ char *symbol_name;
78
+ /* index in the symbol offset field */
79
+ uint32 symbol_index;
80
+ #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
81
+ bool is_symbol_name_allocated;
82
+ #endif
83
+ } AOTRelocation;
84
+
85
+ /* Relocation Group */
86
+ typedef struct AOTRelocationGroup {
87
+ char *section_name;
88
+ /* index in the symbol offset field */
89
+ uint32 name_index;
90
+ uint32 relocation_count;
91
+ AOTRelocation *relocations;
92
+ #if WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_JIT != 0
93
+ bool is_section_name_allocated;
94
+ #endif
95
+ } AOTRelocationGroup;
96
+
97
+ /* AOT function instance */
98
+ typedef struct AOTFunctionInstance {
99
+ char *func_name;
100
+ uint32 func_index;
101
+ bool is_import_func;
102
+ union {
103
+ struct {
104
+ AOTFuncType *func_type;
105
+ /* function pointer linked */
106
+ void *func_ptr;
107
+ } func;
108
+ AOTImportFunc *func_import;
109
+ } u;
110
+ } AOTFunctionInstance;
111
+
112
+ /* Map of a function index to the element ith in
113
+ the export functions array */
114
+ typedef struct ExportFuncMap {
115
+ uint32 func_idx;
116
+ uint32 export_idx;
117
+ } ExportFuncMap;
118
+
119
+ typedef struct AOTModuleInstanceExtra {
120
+ DefPointer(const uint32 *, stack_sizes);
121
+ /*
122
+ * Adjusted shared heap based addr to simple the calculation
123
+ * in the aot code. The value is:
124
+ * shared_heap->base_addr - shared_heap->start_off
125
+ */
126
+ DefPointer(uint8 *, shared_heap_base_addr_adj);
127
+ MemBound shared_heap_start_off;
128
+ MemBound shared_heap_end_off;
129
+ DefPointer(WASMSharedHeap *, shared_heap);
130
+
131
+ WASMModuleInstanceExtraCommon common;
132
+
133
+ /**
134
+ * maps of func indexes to export func indexes, which
135
+ * is sorted by func index for a quick lookup and is
136
+ * created only when first time used.
137
+ */
138
+ ExportFuncMap *export_func_maps;
139
+ AOTFunctionInstance **functions;
140
+ uint32 function_count;
141
+ #if WASM_ENABLE_MULTI_MODULE != 0
142
+ bh_list sub_module_inst_list_head;
143
+ bh_list *sub_module_inst_list;
144
+ WASMModuleInstanceCommon **import_func_module_insts;
145
+ #endif
146
+
147
+ } AOTModuleInstanceExtra;
148
+
149
+ #if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
150
+ typedef struct GOTItem {
151
+ uint32 func_idx;
152
+ struct GOTItem *next;
153
+ } GOTItem, *GOTItemList;
154
+ #endif
155
+
156
+ #if WASM_ENABLE_GC != 0
157
+ typedef struct LocalRefFlag {
158
+ uint32 local_ref_flag_cell_num;
159
+ uint8 *local_ref_flags;
160
+ } LocalRefFlag;
161
+ #endif
162
+
163
+ typedef struct AOTModule {
164
+ uint32 module_type;
165
+
166
+ /* the package version read from the AOT file */
167
+ uint32 package_version;
168
+
169
+ /* import memories */
170
+ uint32 import_memory_count;
171
+ AOTImportMemory *import_memories;
172
+
173
+ /* memory info */
174
+ uint32 memory_count;
175
+ AOTMemory *memories;
176
+
177
+ /* init data */
178
+ uint32 mem_init_data_count;
179
+ AOTMemInitData **mem_init_data_list;
180
+
181
+ /* native symbol */
182
+ void **native_symbol_list;
183
+
184
+ /* import tables */
185
+ uint32 import_table_count;
186
+ AOTImportTable *import_tables;
187
+
188
+ /* tables */
189
+ uint32 table_count;
190
+ AOTTable *tables;
191
+
192
+ /* table init data info */
193
+ uint32 table_init_data_count;
194
+ AOTTableInitData **table_init_data_list;
195
+
196
+ /* type info */
197
+ uint32 type_count;
198
+ AOTType **types;
199
+
200
+ /* import global variable info */
201
+ uint32 import_global_count;
202
+ AOTImportGlobal *import_globals;
203
+
204
+ /* global variable info */
205
+ uint32 global_count;
206
+ AOTGlobal *globals;
207
+
208
+ /* total global variable size */
209
+ uint32 global_data_size;
210
+
211
+ /* import function info */
212
+ uint32 import_func_count;
213
+ AOTImportFunc *import_funcs;
214
+
215
+ /* function info */
216
+ uint32 func_count;
217
+ /* func pointers of AOTed (un-imported) functions */
218
+ void **func_ptrs;
219
+ /* func type indexes of AOTed (un-imported) functions */
220
+ uint32 *func_type_indexes;
221
+ #if WASM_ENABLE_AOT_STACK_FRAME != 0
222
+ /* max local cell nums of AOTed (un-imported) functions */
223
+ uint32 *max_local_cell_nums;
224
+ /* max stack cell nums of AOTed (un-imported) functions */
225
+ uint32 *max_stack_cell_nums;
226
+ #endif
227
+
228
+ #if WASM_ENABLE_GC != 0
229
+ /* params + locals ref flags of (both import and AOTed) functions */
230
+ LocalRefFlag *func_local_ref_flags;
231
+ #endif
232
+
233
+ /* export info */
234
+ uint32 export_count;
235
+ AOTExport *exports;
236
+
237
+ /* start function index, -1 denotes no start function */
238
+ uint32 start_func_index;
239
+ /* start function, point to AOTed function */
240
+ void *start_function;
241
+
242
+ uint32 malloc_func_index;
243
+ uint32 free_func_index;
244
+ uint32 retain_func_index;
245
+
246
+ /* AOTed code */
247
+ void *code;
248
+ uint32 code_size;
249
+
250
+ /* literal for AOTed code */
251
+ uint8 *literal;
252
+ uint32 literal_size;
253
+
254
+ #if defined(BH_PLATFORM_WINDOWS)
255
+ /* extra plt data area for __ymm, __xmm and __real constants
256
+ in Windows platform */
257
+ uint8 *extra_plt_data;
258
+ uint32 extra_plt_data_size;
259
+ uint32 ymm_plt_count;
260
+ uint32 xmm_plt_count;
261
+ uint32 real_plt_count;
262
+ uint32 float_plt_count;
263
+ #endif
264
+
265
+ #if defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)
266
+ uint32 got_item_count;
267
+ GOTItemList got_item_list;
268
+ GOTItemList got_item_list_end;
269
+ void **got_func_ptrs;
270
+ #endif
271
+
272
+ /* data sections in AOT object file, including .data, .rodata
273
+ and .rodata.cstN. */
274
+ AOTObjectDataSection *data_sections;
275
+ uint32 data_section_count;
276
+
277
+ /* constant string set */
278
+ HashMap *const_str_set;
279
+
280
+ /* the index of auxiliary __data_end global,
281
+ -1 means unexported */
282
+ uint32 aux_data_end_global_index;
283
+ /* auxiliary __data_end exported by wasm app */
284
+ uint64 aux_data_end;
285
+
286
+ /* the index of auxiliary __heap_base global,
287
+ -1 means unexported */
288
+ uint32 aux_heap_base_global_index;
289
+ /* auxiliary __heap_base exported by wasm app */
290
+ uint64 aux_heap_base;
291
+
292
+ /* the index of auxiliary stack top global,
293
+ -1 means unexported */
294
+ uint32 aux_stack_top_global_index;
295
+ /* auxiliary stack bottom resolved */
296
+ uint64 aux_stack_bottom;
297
+ /* auxiliary stack size resolved */
298
+ uint32 aux_stack_size;
299
+
300
+ /* is indirect mode or not */
301
+ bool is_indirect_mode;
302
+
303
+ #if WASM_ENABLE_LIBC_WASI != 0
304
+ WASIArguments wasi_args;
305
+ bool import_wasi_api;
306
+ #endif
307
+
308
+ #if WASM_ENABLE_MULTI_MODULE != 0
309
+ /* TODO: add mutex for mutli-thread? */
310
+ bh_list import_module_list_head;
311
+ bh_list *import_module_list;
312
+ #endif
313
+
314
+ #if WASM_ENABLE_GC != 0
315
+ /* Ref types hash set */
316
+ HashMap *ref_type_set;
317
+ struct WASMRttType **rtt_types;
318
+ korp_mutex rtt_type_lock;
319
+ #if WASM_ENABLE_STRINGREF != 0
320
+ /* special rtts for stringref types
321
+ - stringref
322
+ - stringview_wtf8
323
+ - stringview_wtf16
324
+ - stringview_iter
325
+ */
326
+ struct WASMRttType *stringref_rtts[4];
327
+ uint32 string_literal_count;
328
+ uint32 *string_literal_lengths;
329
+ const uint8 **string_literal_ptrs;
330
+ #endif
331
+ #endif
332
+
333
+ #if WASM_ENABLE_DEBUG_AOT != 0
334
+ void *elf_hdr;
335
+ uint32 elf_size;
336
+ #endif
337
+ #if WASM_ENABLE_CUSTOM_NAME_SECTION != 0
338
+ const char **aux_func_names;
339
+ uint32 *aux_func_indexes;
340
+ uint32 aux_func_name_count;
341
+ #endif
342
+ #if WASM_ENABLE_LOAD_CUSTOM_SECTION != 0
343
+ WASMCustomSection *custom_section_list;
344
+ #endif
345
+
346
+ /* user defined name */
347
+ char *name;
348
+
349
+ /* Whether the underlying wasm binary buffer can be freed */
350
+ bool is_binary_freeable;
351
+
352
+ /* `.data` sections merged into one mmaped to reduce the tlb cache miss */
353
+ uint8 *merged_data_sections;
354
+ uint32 merged_data_sections_size;
355
+ /* `.data` and `.text` sections merged into one large mmaped section */
356
+ uint8 *merged_data_text_sections;
357
+ uint32 merged_data_text_sections_size;
358
+
359
+ #if WASM_ENABLE_AOT_STACK_FRAME != 0
360
+ uint32 feature_flags;
361
+ #endif
362
+ } AOTModule;
363
+
364
+ #define AOTMemoryInstance WASMMemoryInstance
365
+ #define AOTTableInstance WASMTableInstance
366
+ #define AOTModuleInstance WASMModuleInstance
367
+
368
+ #if WASM_ENABLE_MULTI_MODULE != 0
369
+ #define AOTSubModInstNode WASMSubModInstNode
370
+ #endif
371
+
372
+ /* Target info, read from ELF header of object file */
373
+ typedef struct AOTTargetInfo {
374
+ /* Binary type, elf32l/elf32b/elf64l/elf64b */
375
+ uint16 bin_type;
376
+ /* ABI type */
377
+ uint16 abi_type;
378
+ /* Object file type */
379
+ uint16 e_type;
380
+ /* Architecture */
381
+ uint16 e_machine;
382
+ /* Object file version */
383
+ uint32 e_version;
384
+ /* Processor-specific flags */
385
+ uint32 e_flags;
386
+ /* Specify wasm features supported */
387
+ uint64 feature_flags;
388
+ /* Reserved */
389
+ uint64 reserved;
390
+ /* Arch name */
391
+ char arch[16];
392
+ } AOTTargetInfo;
393
+
394
+ typedef struct AOTFuncPerfProfInfo {
395
+ /* total execution time */
396
+ uint64 total_exec_time;
397
+ /* total execution count */
398
+ uint32 total_exec_cnt;
399
+ /* children execution time */
400
+ uint64 children_exec_time;
401
+ } AOTFuncPerfProfInfo;
402
+
403
+ /* AOT auxiliary call stack */
404
+ typedef struct AOTFrame {
405
+ /* The frame of the caller which is calling current function */
406
+ struct AOTFrame *prev_frame;
407
+
408
+ /* The non-imported function index of current function */
409
+ uintptr_t func_index;
410
+
411
+ /* Used when performance profiling is enabled */
412
+ uintptr_t time_started;
413
+
414
+ /* Used when performance profiling is enabled */
415
+ AOTFuncPerfProfInfo *func_perf_prof_info;
416
+
417
+ /* Instruction pointer: offset to the bytecode array */
418
+ uintptr_t ip_offset;
419
+
420
+ /* Operand stack top pointer of the current frame */
421
+ uint32 *sp;
422
+
423
+ /* Frame ref flags (GC only) */
424
+ uint8 *frame_ref;
425
+
426
+ /**
427
+ * Frame data, the layout is:
428
+ * local area: parameters and local variables
429
+ * stack area: wasm operand stack
430
+ * frame ref flags (GC only):
431
+ * whether each cell in local and stack area is a GC obj
432
+ * currently local's ref flags are stored in AOTModule,
433
+ * here we only reserve the padding bytes
434
+ */
435
+ uint32 lp[1];
436
+ } AOTFrame;
437
+
438
+ #if WASM_ENABLE_STATIC_PGO != 0
439
+ /* The bitmaps fields in LLVMProfileRawHeader, LLVMProfileData,
440
+ * LLVMProfileData_64 all dummy fields, it's used in MC/DC code coverage
441
+ * instead of PGO. See https://llvm.org/docs/InstrProfileFormat.html#bitmap */
442
+ typedef struct LLVMProfileRawHeader {
443
+ uint64 magic;
444
+ uint64 version;
445
+ uint64 binary_ids_size;
446
+ uint64 num_prof_data;
447
+ uint64 padding_bytes_before_counters;
448
+ uint64 num_prof_counters;
449
+ uint64 padding_bytes_after_counters;
450
+ uint64 num_prof_bitmaps;
451
+ uint64 padding_bytes_after_bitmaps;
452
+ uint64 names_size;
453
+ uint64 counters_delta;
454
+ uint64 bitmap_delta;
455
+ uint64 names_delta;
456
+ uint64 value_kind_last;
457
+ } LLVMProfileRawHeader;
458
+
459
+ typedef struct ValueProfNode {
460
+ uint64 value;
461
+ uint64 count;
462
+ struct ValueProfNode *next;
463
+ } ValueProfNode;
464
+
465
+ /* The profiling data of data sections created by aot compiler and
466
+ used when profiling, the width of pointer can be 8 bytes (64-bit)
467
+ or 4 bytes (32-bit) */
468
+ typedef struct LLVMProfileData {
469
+ uint64 func_md5;
470
+ uint64 func_hash;
471
+ uint64 offset_counters;
472
+ uint64 offset_bitmaps;
473
+ uintptr_t func_ptr;
474
+ ValueProfNode **values;
475
+ uint32 num_counters;
476
+ uint16 num_value_sites[2];
477
+ uint32 num_bitmaps;
478
+ } LLVMProfileData;
479
+
480
+ /* The profiling data for writing to the output file, the width of
481
+ pointer is 8 bytes suppose we always use wamrc and llvm-profdata
482
+ with 64-bit mode */
483
+ typedef struct LLVMProfileData_64 {
484
+ uint64 func_md5;
485
+ uint64 func_hash;
486
+ uint64 offset_counters;
487
+ uint64 offset_bitmaps;
488
+ uint64 func_ptr;
489
+ uint64 values;
490
+ uint32 num_counters;
491
+ uint16 num_value_sites[2];
492
+ uint32 num_bitmaps;
493
+ } LLVMProfileData_64;
494
+ #endif /* end of WASM_ENABLE_STATIC_PGO != 0 */
495
+
496
+ /**
497
+ * Load a AOT module from aot file buffer
498
+ * @param buf the byte buffer which contains the AOT file data
499
+ * @param size the size of the buffer
500
+ * @param error_buf output of the error info
501
+ * @param error_buf_size the size of the error string
502
+ *
503
+ * @return return AOT module loaded, NULL if failed
504
+ */
505
+ AOTModule *
506
+ aot_load_from_aot_file(const uint8 *buf, uint32 size, const LoadArgs *args,
507
+ char *error_buf, uint32 error_buf_size);
508
+
509
+ /**
510
+ * Load a AOT module from a specified AOT section list.
511
+ *
512
+ * @param section_list the section list which contains each section data
513
+ * @param error_buf output of the error info
514
+ * @param error_buf_size the size of the error string
515
+ *
516
+ * @return return AOT module loaded, NULL if failed
517
+ */
518
+ AOTModule *
519
+ aot_load_from_sections(AOTSection *section_list, char *error_buf,
520
+ uint32 error_buf_size);
521
+
522
+ /**
523
+ * Unload a AOT module.
524
+ *
525
+ * @param module the module to be unloaded
526
+ */
527
+ void
528
+ aot_unload(AOTModule *module);
529
+
530
+ /**
531
+ * Resolve symbols for an AOT module
532
+ */
533
+ bool
534
+ aot_resolve_symbols(AOTModule *module);
535
+
536
+ /**
537
+ * Helper function to resolve a single function
538
+ */
539
+ bool
540
+ aot_resolve_import_func(AOTModule *module, AOTImportFunc *import_func);
541
+
542
+ /**
543
+ * Instantiate a AOT module.
544
+ *
545
+ * @param module the AOT module to instantiate
546
+ * @param parent the parent module instance
547
+ * @param heap_size the default heap size of the module instance, a heap will
548
+ * be created besides the app memory space. Both wasm app and native
549
+ * function can allocate memory from the heap. If heap_size is 0, the
550
+ * default heap size will be used.
551
+ * @param error_buf buffer to output the error info if failed
552
+ * @param error_buf_size the size of the error buffer
553
+ *
554
+ * @return return the instantiated AOT module instance, NULL if failed
555
+ */
556
+ AOTModuleInstance *
557
+ aot_instantiate(AOTModule *module, AOTModuleInstance *parent,
558
+ WASMExecEnv *exec_env_main, uint32 stack_size, uint32 heap_size,
559
+ uint32 max_memory_pages, char *error_buf,
560
+ uint32 error_buf_size);
561
+
562
+ /**
563
+ * Deinstantiate a AOT module instance, destroy the resources.
564
+ *
565
+ * @param module_inst the AOT module instance to destroy
566
+ * @param is_sub_inst the flag of sub instance
567
+ */
568
+ void
569
+ aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
570
+
571
+ /**
572
+ * Lookup an exported function in the AOT module instance.
573
+ *
574
+ * @param module_inst the module instance
575
+ * @param name the name of the function
576
+ *
577
+ * @return the function instance found
578
+ */
579
+ AOTFunctionInstance *
580
+ aot_lookup_function(const AOTModuleInstance *module_inst, const char *name);
581
+
582
+ /**
583
+ * Lookup an exported function in the AOT module instance with
584
+ * the function index.
585
+ */
586
+ AOTFunctionInstance *
587
+ aot_lookup_function_with_idx(AOTModuleInstance *module_inst, uint32 func_idx);
588
+
589
+ AOTMemoryInstance *
590
+ aot_lookup_memory(AOTModuleInstance *module_inst, char const *name);
591
+
592
+ AOTMemoryInstance *
593
+ aot_get_default_memory(AOTModuleInstance *module_inst);
594
+
595
+ AOTMemoryInstance *
596
+ aot_get_memory_with_idx(AOTModuleInstance *module_inst, uint32 mem_idx);
597
+
598
+ /**
599
+ * Get a function in the AOT module instance.
600
+ *
601
+ * @param module_inst the module instance
602
+ * @param func_idx the index of the function
603
+ *
604
+ * @return the function instance found
605
+ */
606
+ AOTFunctionInstance *
607
+ aot_get_function_instance(AOTModuleInstance *module_inst, uint32 func_idx);
608
+
609
+ /**
610
+ * Call the given AOT function of a AOT module instance with
611
+ * arguments.
612
+ *
613
+ * @param exec_env the execution environment
614
+ * @param function the function to be called
615
+ * @param argc the number of arguments
616
+ * @param argv the arguments. If the function method has return value,
617
+ * the first (or first two in case 64-bit return value) element of
618
+ * argv stores the return value of the called AOT function after this
619
+ * function returns.
620
+ *
621
+ * @return true if success, false otherwise and exception will be thrown,
622
+ * the caller can call aot_get_exception to get exception info.
623
+ */
624
+ bool
625
+ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
626
+ unsigned argc, uint32 argv[]);
627
+
628
+ /**
629
+ * Set AOT module instance exception with exception string
630
+ *
631
+ * @param module the AOT module instance
632
+ *
633
+ * @param exception current exception string
634
+ */
635
+ void
636
+ aot_set_exception(AOTModuleInstance *module_inst, const char *exception);
637
+
638
+ void
639
+ aot_set_exception_with_id(AOTModuleInstance *module_inst, uint32 id);
640
+
641
+ /**
642
+ * Get exception info of the AOT module instance.
643
+ *
644
+ * @param module_inst the AOT module instance
645
+ *
646
+ * @return the exception string
647
+ */
648
+ const char *
649
+ aot_get_exception(AOTModuleInstance *module_inst);
650
+
651
+ /**
652
+ * @brief Copy exception in buffer passed as parameter. Thread-safe version of
653
+ * `aot_get_exception()`
654
+ * @note Buffer size must be no smaller than EXCEPTION_BUF_LEN
655
+ * @return true if exception found, false otherwise
656
+ */
657
+ bool
658
+ aot_copy_exception(AOTModuleInstance *module_inst, char *exception_buf);
659
+
660
+ uint64
661
+ aot_module_malloc_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
662
+ uint64 size, void **p_native_addr);
663
+
664
+ uint64
665
+ aot_module_realloc_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
666
+ uint64 ptr, uint64 size, void **p_native_addr);
667
+
668
+ void
669
+ aot_module_free_internal(AOTModuleInstance *module_inst, WASMExecEnv *env,
670
+ uint64 ptr);
671
+
672
+ uint64
673
+ aot_module_malloc(AOTModuleInstance *module_inst, uint64 size,
674
+ void **p_native_addr);
675
+
676
+ uint64
677
+ aot_module_realloc(AOTModuleInstance *module_inst, uint64 ptr, uint64 size,
678
+ void **p_native_addr);
679
+
680
+ void
681
+ aot_module_free(AOTModuleInstance *module_inst, uint64 ptr);
682
+
683
+ uint64
684
+ aot_module_dup_data(AOTModuleInstance *module_inst, const char *src,
685
+ uint64 size);
686
+
687
+ bool
688
+ aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
689
+
690
+ bool
691
+ aot_enlarge_memory_with_idx(AOTModuleInstance *module_inst,
692
+ uint32 inc_page_count, uint32 memidx);
693
+
694
+ /**
695
+ * Invoke native function from aot code
696
+ */
697
+ bool
698
+ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
699
+ uint32 *argv);
700
+
701
+ bool
702
+ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
703
+ uint32 argc, uint32 *argv);
704
+
705
+ /**
706
+ * Check whether the app address and the buf is inside the linear memory,
707
+ * and convert the app address into native address
708
+ */
709
+ bool
710
+ aot_check_app_addr_and_convert(AOTModuleInstance *module_inst, bool is_str,
711
+ uint64 app_buf_addr, uint64 app_buf_size,
712
+ void **p_native_addr);
713
+
714
+ uint32
715
+ aot_get_plt_table_size(void);
716
+
717
+ void *
718
+ aot_memmove(void *dest, const void *src, size_t n);
719
+
720
+ void *
721
+ aot_memset(void *s, int c, size_t n);
722
+
723
+ double
724
+ aot_sqrt(double x);
725
+
726
+ float
727
+ aot_sqrtf(float x);
728
+
729
+ #if WASM_ENABLE_BULK_MEMORY != 0
730
+ bool
731
+ aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
732
+ uint32 len, size_t dst);
733
+
734
+ bool
735
+ aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);
736
+ #endif
737
+
738
+ #if WASM_ENABLE_THREAD_MGR != 0
739
+ bool
740
+ aot_set_aux_stack(WASMExecEnv *exec_env, uint64 start_offset, uint32 size);
741
+
742
+ bool
743
+ aot_get_aux_stack(WASMExecEnv *exec_env, uint64 *start_offset, uint32 *size);
744
+ #endif
745
+
746
+ void
747
+ aot_get_module_mem_consumption(const AOTModule *module,
748
+ WASMModuleMemConsumption *mem_conspn);
749
+
750
+ void
751
+ aot_get_module_inst_mem_consumption(const AOTModuleInstance *module_inst,
752
+ WASMModuleInstMemConsumption *mem_conspn);
753
+
754
+ #if WASM_ENABLE_REF_TYPES != 0 || WASM_ENABLE_GC != 0
755
+ void
756
+ aot_drop_table_seg(AOTModuleInstance *module_inst, uint32 tbl_seg_idx);
757
+
758
+ void
759
+ aot_table_init(AOTModuleInstance *module_inst, uint32 tbl_idx,
760
+ uint32 tbl_seg_idx, uint32 length, uint32 src_offset,
761
+ uint32 dst_offset);
762
+
763
+ void
764
+ aot_table_copy(AOTModuleInstance *module_inst, uint32 src_tbl_idx,
765
+ uint32 dst_tbl_idx, uint32 length, uint32 src_offset,
766
+ uint32 dst_offset);
767
+
768
+ void
769
+ aot_table_fill(AOTModuleInstance *module_inst, uint32 tbl_idx, uint32 length,
770
+ table_elem_type_t val, uint32 data_offset);
771
+
772
+ uint32
773
+ aot_table_grow(AOTModuleInstance *module_inst, uint32 tbl_idx,
774
+ uint32 inc_entries, table_elem_type_t init_val);
775
+ #endif
776
+
777
+ bool
778
+ aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index);
779
+
780
+ void
781
+ aot_free_frame(WASMExecEnv *exec_env);
782
+
783
+ void
784
+ aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame);
785
+
786
+ bool
787
+ aot_create_call_stack(struct WASMExecEnv *exec_env);
788
+
789
+ #if WASM_ENABLE_COPY_CALL_STACK != 0
790
+ uint32
791
+ aot_copy_callstack(WASMExecEnv *exec_env, WASMCApiFrame *buffer,
792
+ const uint32 length, const uint32 skip_n, char *error_buf,
793
+ uint32_t error_buf_size);
794
+ #endif // WASM_ENABLE_COPY_CALL_STACK
795
+
796
+ /**
797
+ * @brief Dump wasm call stack or get the size
798
+ *
799
+ * @param exec_env the execution environment
800
+ * @param print whether to print to stdout or not
801
+ * @param buf buffer to store the dumped content
802
+ * @param len length of the buffer
803
+ *
804
+ * @return when print is true, return the bytes printed out to stdout; when
805
+ * print is false and buf is NULL, return the size required to store the
806
+ * callstack content; when print is false and buf is not NULL, return the size
807
+ * dumped to the buffer, 0 means error and data in buf may be invalid
808
+ */
809
+ uint32
810
+ aot_dump_call_stack(WASMExecEnv *exec_env, bool print, char *buf, uint32 len);
811
+
812
+ void
813
+ aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
814
+
815
+ double
816
+ aot_summarize_wasm_execute_time(const AOTModuleInstance *inst);
817
+
818
+ double
819
+ aot_get_wasm_func_exec_time(const AOTModuleInstance *inst,
820
+ const char *func_name);
821
+
822
+ const uint8 *
823
+ aot_get_custom_section(const AOTModule *module, const char *name, uint32 *len);
824
+
825
+ const void *
826
+ aot_get_data_section_addr(AOTModule *module, const char *section_name,
827
+ uint32 *p_data_size);
828
+
829
+ #if WASM_ENABLE_STATIC_PGO != 0
830
+ void
831
+ llvm_profile_instrument_target(uint64 target_value, void *data,
832
+ uint32 counter_idx);
833
+
834
+ void
835
+ llvm_profile_instrument_memop(uint64 target_value, void *data,
836
+ uint32 counter_idx);
837
+
838
+ uint32
839
+ aot_get_pgo_prof_data_size(AOTModuleInstance *module_inst);
840
+
841
+ uint32
842
+ aot_dump_pgo_prof_data_to_buf(AOTModuleInstance *module_inst, char *buf,
843
+ uint32 len);
844
+
845
+ void
846
+ aot_exchange_uint16(uint8 *p_data);
847
+
848
+ void
849
+ aot_exchange_uint32(uint8 *p_data);
850
+
851
+ void
852
+ aot_exchange_uint64(uint8 *p_data);
853
+ #endif /* end of WASM_ENABLE_STATIC_PGO != 0 */
854
+
855
+ #if WASM_ENABLE_GC != 0
856
+ void *
857
+ aot_create_func_obj(AOTModuleInstance *module_inst, uint32 func_idx,
858
+ bool throw_exce, char *error_buf, uint32 error_buf_size);
859
+
860
+ bool
861
+ aot_obj_is_instance_of(AOTModuleInstance *module_inst, WASMObjectRef gc_obj,
862
+ uint32 type_index);
863
+
864
+ /* Whether func type1 is one of super types of func type2 */
865
+ bool
866
+ aot_func_type_is_super_of(AOTModuleInstance *module_inst, uint32 type_idx1,
867
+ uint32 type_idx2);
868
+
869
+ WASMRttTypeRef
870
+ aot_rtt_type_new(AOTModuleInstance *module_inst, uint32 type_index);
871
+
872
+ bool
873
+ aot_array_init_with_data(AOTModuleInstance *module_inst, uint32 seg_index,
874
+ uint32 data_seg_offset, WASMArrayObjectRef array_obj,
875
+ uint32 elem_size, uint32 array_len);
876
+
877
+ bool
878
+ aot_traverse_gc_rootset(WASMExecEnv *exec_env, void *heap);
879
+ #endif /* end of WASM_ENABLE_GC != 0 */
880
+
881
+ char *
882
+ aot_const_str_set_insert(const uint8 *str, int32 len, AOTModule *module,
883
+ #if (WASM_ENABLE_WORD_ALIGN_READ != 0)
884
+ bool is_vram_word_align,
885
+ #endif
886
+ char *error_buf, uint32 error_buf_size);
887
+
888
+ bool
889
+ aot_set_module_name(AOTModule *module, const char *name, char *error_buf,
890
+ uint32_t error_buf_size);
891
+
892
+ const char *
893
+ aot_get_module_name(AOTModule *module);
894
+
895
+ #ifdef __cplusplus
896
+ } /* end of extern "C" */
897
+ #endif
898
+
899
+ #endif /* end of _AOT_RUNTIME_H_ */