aot_runtime.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _AOT_RUNTIME_H_
  6. #define _AOT_RUNTIME_H_
  7. #include "bh_platform.h"
  8. #include "../common/wasm_runtime_common.h"
  9. #include "../interpreter/wasm_runtime.h"
  10. #include "../compilation/aot.h"
  11. #if WASM_ENABLE_JIT != 0
  12. #include "../compilation/aot_llvm.h"
  13. #endif
  14. #ifdef __cplusplus
  15. extern "C" {
  16. #endif
  17. typedef enum AOTExceptionID {
  18. EXCE_UNREACHABLE = 0,
  19. EXCE_OUT_OF_MEMORY,
  20. EXCE_OUT_OF_BOUNDS_MEMORY_ACCESS,
  21. EXCE_INTEGER_OVERFLOW,
  22. EXCE_INTEGER_DIVIDE_BY_ZERO,
  23. EXCE_INVALID_CONVERSION_TO_INTEGER,
  24. EXCE_INVALID_FUNCTION_TYPE_INDEX,
  25. EXCE_INVALID_FUNCTION_INDEX,
  26. EXCE_UNDEFINED_ELEMENT,
  27. EXCE_UNINITIALIZED_ELEMENT,
  28. EXCE_CALL_UNLINKED_IMPORT_FUNC,
  29. EXCE_NATIVE_STACK_OVERFLOW,
  30. EXCE_UNALIGNED_ATOMIC,
  31. EXCE_AUX_STACK_OVERFLOW,
  32. EXCE_AUX_STACK_UNDERFLOW,
  33. EXCE_OUT_OF_BOUNDS_TABLE_ACCESS,
  34. EXCE_NUM,
  35. } AOTExceptionID;
  36. typedef enum AOTSectionType {
  37. AOT_SECTION_TYPE_TARGET_INFO = 0,
  38. AOT_SECTION_TYPE_INIT_DATA = 1,
  39. AOT_SECTION_TYPE_TEXT = 2,
  40. AOT_SECTION_TYPE_FUNCTION = 3,
  41. AOT_SECTION_TYPE_EXPORT = 4,
  42. AOT_SECTION_TYPE_RELOCATION = 5,
  43. AOT_SECTION_TYPE_SIGANATURE = 6,
  44. AOT_SECTION_TYPE_CUSTOM = 100,
  45. } AOTSectionType;
  46. typedef enum AOTCustomSectionType {
  47. AOT_CUSTOM_SECTION_NATIVE_SYMBOL = 1,
  48. AOT_CUSTOM_SECTION_ACCESS_CONTROL = 2,
  49. } AOTCustomSectionType;
  50. typedef struct AOTObjectDataSection {
  51. char *name;
  52. uint8 *data;
  53. uint32 size;
  54. } AOTObjectDataSection;
  55. /* Relocation info */
  56. typedef struct AOTRelocation {
  57. uint64 relocation_offset;
  58. uint64 relocation_addend;
  59. uint32 relocation_type;
  60. char *symbol_name;
  61. /* index in the symbol offset field */
  62. uint32 symbol_index;
  63. } AOTRelocation;
  64. /* Relocation Group */
  65. typedef struct AOTRelocationGroup {
  66. char *section_name;
  67. /* index in the symbol offset field */
  68. uint32 name_index;
  69. uint32 relocation_count;
  70. AOTRelocation *relocations;
  71. } AOTRelocationGroup;
  72. /* AOT function instance */
  73. typedef struct AOTFunctionInstance {
  74. char *func_name;
  75. uint32 func_index;
  76. bool is_import_func;
  77. union {
  78. struct {
  79. AOTFuncType *func_type;
  80. /* function pointer linked */
  81. void *func_ptr;
  82. } func;
  83. AOTImportFunc *func_import;
  84. } u;
  85. } AOTFunctionInstance;
  86. #if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)
  87. /* clang-format off */
  88. typedef struct AOTUnwindInfo {
  89. uint8 Version : 3;
  90. uint8 Flags : 5;
  91. uint8 SizeOfProlog;
  92. uint8 CountOfCodes;
  93. uint8 FrameRegister : 4;
  94. uint8 FrameOffset : 4;
  95. struct {
  96. struct {
  97. uint8 CodeOffset;
  98. uint8 UnwindOp : 4;
  99. uint8 OpInfo : 4;
  100. };
  101. uint16 FrameOffset;
  102. } UnwindCode[1];
  103. } AOTUnwindInfo;
  104. /* clang-format on */
  105. /* size of mov instruction and jmp instruction */
  106. #define PLT_ITEM_SIZE 12
  107. #endif
  108. typedef struct AOTModule {
  109. uint32 module_type;
  110. /* import memories */
  111. uint32 import_memory_count;
  112. AOTImportMemory *import_memories;
  113. /* memory info */
  114. uint32 memory_count;
  115. AOTMemory *memories;
  116. /* init data */
  117. uint32 mem_init_data_count;
  118. AOTMemInitData **mem_init_data_list;
  119. /* native symobl */
  120. uint32 native_symbol_count;
  121. void **native_symbol_list;
  122. /* import tables */
  123. uint32 import_table_count;
  124. AOTImportTable *import_tables;
  125. /* tables */
  126. uint32 table_count;
  127. AOTTable *tables;
  128. /* table init data info */
  129. uint32 table_init_data_count;
  130. AOTTableInitData **table_init_data_list;
  131. /* function type info */
  132. uint32 func_type_count;
  133. AOTFuncType **func_types;
  134. /* import global varaible info */
  135. uint32 import_global_count;
  136. AOTImportGlobal *import_globals;
  137. /* global variable info */
  138. uint32 global_count;
  139. AOTGlobal *globals;
  140. /* total global variable size */
  141. uint32 global_data_size;
  142. /* import function info */
  143. uint32 import_func_count;
  144. AOTImportFunc *import_funcs;
  145. /* function info */
  146. uint32 func_count;
  147. /* point to AOTed/JITed functions */
  148. void **func_ptrs;
  149. /* function type indexes */
  150. uint32 *func_type_indexes;
  151. /* export info */
  152. uint32 export_count;
  153. AOTExport *exports;
  154. /* start function index, -1 denotes no start function */
  155. uint32 start_func_index;
  156. /* start function, point to AOTed/JITed function */
  157. void *start_function;
  158. uint32 malloc_func_index;
  159. uint32 free_func_index;
  160. uint32 retain_func_index;
  161. /* AOTed code, NULL for JIT mode */
  162. void *code;
  163. uint32 code_size;
  164. /* literal for AOTed code, NULL for JIT mode */
  165. uint8 *literal;
  166. uint32 literal_size;
  167. #if (defined(BUILD_TARGET_X86_64) || defined(BUILD_TARGET_AMD_64)) \
  168. && defined(BH_PLATFORM_WINDOWS)
  169. /* extra plt data area for __xmm and __real constants
  170. in Windows platform, NULL for JIT mode */
  171. uint8 *extra_plt_data;
  172. uint32 extra_plt_data_size;
  173. uint32 xmm_plt_count;
  174. uint32 real_plt_count;
  175. uint32 float_plt_count;
  176. #endif
  177. #if defined(OS_ENABLE_HW_BOUND_CHECK) && defined(BH_PLATFORM_WINDOWS)
  178. /* dynamic function table to be added by RtlAddFunctionTable(),
  179. used to unwind the call stack and register exception handler
  180. for AOT functions */
  181. RUNTIME_FUNCTION *rtl_func_table;
  182. bool rtl_func_table_registered;
  183. #endif
  184. /* data sections in AOT object file, including .data, .rodata
  185. * and .rodata.cstN. NULL for JIT mode. */
  186. AOTObjectDataSection *data_sections;
  187. uint32 data_section_count;
  188. /* constant string set */
  189. HashMap *const_str_set;
  190. /* the index of auxiliary __data_end global,
  191. -1 means unexported */
  192. uint32 aux_data_end_global_index;
  193. /* auxiliary __data_end exported by wasm app */
  194. uint32 aux_data_end;
  195. /* the index of auxiliary __heap_base global,
  196. -1 means unexported */
  197. uint32 aux_heap_base_global_index;
  198. /* auxiliary __heap_base exported by wasm app */
  199. uint32 aux_heap_base;
  200. /* the index of auxiliary stack top global,
  201. -1 means unexported */
  202. uint32 aux_stack_top_global_index;
  203. /* auxiliary stack bottom resolved */
  204. uint32 aux_stack_bottom;
  205. /* auxiliary stack size resolved */
  206. uint32 aux_stack_size;
  207. /* is jit mode or not */
  208. bool is_jit_mode;
  209. #if WASM_ENABLE_JIT != 0
  210. WASMModule *wasm_module;
  211. AOTCompContext *comp_ctx;
  212. AOTCompData *comp_data;
  213. #endif
  214. #if WASM_ENABLE_LIBC_WASI != 0
  215. WASIArguments wasi_args;
  216. bool is_wasi_module;
  217. #endif
  218. #if WASM_ENABLE_DEBUG_AOT != 0
  219. void *elf_hdr;
  220. uint32 elf_size;
  221. #endif
  222. } AOTModule;
  223. typedef union {
  224. uint64 _make_it_8_bytes_;
  225. void *ptr;
  226. } AOTPointer;
  227. typedef union {
  228. uint64 u64;
  229. uint32 u32[2];
  230. } MemBound;
  231. typedef struct AOTMemoryInstance {
  232. uint32 module_type;
  233. /* shared memory flag */
  234. bool is_shared;
  235. /* memory space info */
  236. uint32 num_bytes_per_page;
  237. uint32 cur_page_count;
  238. uint32 max_page_count;
  239. uint32 memory_data_size;
  240. AOTPointer memory_data;
  241. AOTPointer memory_data_end;
  242. /* heap space info */
  243. AOTPointer heap_data;
  244. AOTPointer heap_data_end;
  245. AOTPointer heap_handle;
  246. /* boundary check constants for aot code */
  247. MemBound mem_bound_check_1byte;
  248. MemBound mem_bound_check_2bytes;
  249. MemBound mem_bound_check_4bytes;
  250. MemBound mem_bound_check_8bytes;
  251. MemBound mem_bound_check_16bytes;
  252. } AOTMemoryInstance;
  253. typedef struct AOTTableInstance {
  254. uint32 cur_size;
  255. /*
  256. * only grow in the range of [:max_size)
  257. * if the table is growable, max_size equals to its declared maximum size
  258. * otherwise, max_size equals to its declared minimum size
  259. */
  260. uint32 max_size;
  261. /*
  262. * +------------------------------+ <--- data
  263. * | ref.func[] or ref.extern[]
  264. * +------------------------------+
  265. */
  266. uint32 data[1];
  267. } AOTTableInstance;
  268. typedef struct AOTModuleInstance {
  269. uint32 module_type;
  270. /* memories */
  271. uint32 memory_count;
  272. AOTPointer memories;
  273. /* global and table info */
  274. uint32 global_data_size;
  275. /*
  276. * the count of AOTTableInstance.
  277. * it includes imported tables and local tables.
  278. *
  279. * TODO: for now we treate imported table like a local table
  280. */
  281. uint32 table_count;
  282. /* points to global_data */
  283. AOTPointer global_data;
  284. /* points to AOTTableInstance[] */
  285. AOTPointer tables;
  286. /* funciton pointer array */
  287. AOTPointer func_ptrs;
  288. /* function type indexes */
  289. AOTPointer func_type_indexes;
  290. /* export info */
  291. uint32 export_func_count;
  292. uint32 export_global_count;
  293. uint32 export_mem_count;
  294. uint32 export_tab_count;
  295. AOTPointer export_funcs;
  296. AOTPointer export_globals;
  297. AOTPointer export_memories;
  298. AOTPointer export_tables;
  299. /* The exception buffer for current thread. */
  300. char cur_exception[128];
  301. /* The custom data that can be set/get by
  302. * wasm_runtime_set_custom_data/wasm_runtime_get_custom_data */
  303. AOTPointer custom_data;
  304. /* The AOT module */
  305. AOTPointer aot_module;
  306. /* WASI context */
  307. AOTPointer wasi_ctx;
  308. /* function performance profiling info list */
  309. AOTPointer func_perf_profilings;
  310. AOTPointer exec_env_singleton;
  311. /* others */
  312. uint32 temp_ret;
  313. uint32 llvm_stack;
  314. uint32 default_wasm_stack_size;
  315. uint32 _padding;
  316. /* store stacktrace information */
  317. AOTPointer frames;
  318. /* reserved */
  319. uint32 reserved[6];
  320. /*
  321. * +------------------------------+ <-- memories.ptr
  322. * | #0 AOTMemoryInstance
  323. * +------------------------------+ <-- global_data.ptr
  324. * | global data
  325. * +------------------------------+ <-- tables.ptr
  326. * | AOTTableInstance[table_count]
  327. * +------------------------------+
  328. */
  329. union {
  330. uint64 _make_it_8_byte_aligned_;
  331. AOTMemoryInstance memory_instances[1];
  332. uint8 bytes[1];
  333. } global_table_data;
  334. } AOTModuleInstance;
  335. /* Target info, read from ELF header of object file */
  336. typedef struct AOTTargetInfo {
  337. /* Binary type, elf32l/elf32b/elf64l/elf64b */
  338. uint16 bin_type;
  339. /* ABI type */
  340. uint16 abi_type;
  341. /* Object file type */
  342. uint16 e_type;
  343. /* Architecture */
  344. uint16 e_machine;
  345. /* Object file version */
  346. uint32 e_version;
  347. /* Processor-specific flags */
  348. uint32 e_flags;
  349. /* Reserved */
  350. uint32 reserved;
  351. /* Arch name */
  352. char arch[16];
  353. } AOTTargetInfo;
  354. typedef struct AOTFuncPerfProfInfo {
  355. /* total execution time */
  356. uint64 total_exec_time;
  357. /* total execution count */
  358. uint32 total_exec_cnt;
  359. } AOTFuncPerfProfInfo;
  360. /* AOT auxiliary call stack */
  361. typedef struct AOTFrame {
  362. struct AOTFrame *prev_frame;
  363. uint32 func_index;
  364. #if WASM_ENABLE_PERF_PROFILING != 0
  365. uint64 time_started;
  366. AOTFuncPerfProfInfo *func_perf_prof_info;
  367. #endif
  368. } AOTFrame;
  369. /**
  370. * Load a AOT module from aot file buffer
  371. * @param buf the byte buffer which contains the AOT file data
  372. * @param size the size of the buffer
  373. * @param error_buf output of the error info
  374. * @param error_buf_size the size of the error string
  375. *
  376. * @return return AOT module loaded, NULL if failed
  377. */
  378. AOTModule *
  379. aot_load_from_aot_file(const uint8 *buf, uint32 size, char *error_buf,
  380. uint32 error_buf_size);
  381. /**
  382. * Load a AOT module from a specified AOT section list.
  383. *
  384. * @param section_list the section list which contains each section data
  385. * @param error_buf output of the error info
  386. * @param error_buf_size the size of the error string
  387. *
  388. * @return return AOT module loaded, NULL if failed
  389. */
  390. AOTModule *
  391. aot_load_from_sections(AOTSection *section_list, char *error_buf,
  392. uint32 error_buf_size);
  393. #if WASM_ENABLE_JIT != 0
  394. /**
  395. * Convert WASM module to AOT module
  396. *
  397. * @param wasm_module the WASM module to convert
  398. * @param error_buf output of the error info
  399. * @param error_buf_size the size of the error string
  400. *
  401. * @return return AOT module loaded, NULL if failed
  402. */
  403. AOTModule *
  404. aot_convert_wasm_module(WASMModule *wasm_module, char *error_buf,
  405. uint32 error_buf_size);
  406. #endif
  407. /**
  408. * Unload a AOT module.
  409. *
  410. * @param module the module to be unloaded
  411. */
  412. void
  413. aot_unload(AOTModule *module);
  414. /**
  415. * Instantiate a AOT module.
  416. *
  417. * @param module the AOT module to instantiate
  418. * @param is_sub_inst the flag of sub instance
  419. * @param heap_size the default heap size of the module instance, a heap will
  420. * be created besides the app memory space. Both wasm app and native
  421. * function can allocate memory from the heap. If heap_size is 0, the
  422. * default heap size will be used.
  423. * @param error_buf buffer to output the error info if failed
  424. * @param error_buf_size the size of the error buffer
  425. *
  426. * @return return the instantiated AOT module instance, NULL if failed
  427. */
  428. AOTModuleInstance *
  429. aot_instantiate(AOTModule *module, bool is_sub_inst, uint32 stack_size,
  430. uint32 heap_size, char *error_buf, uint32 error_buf_size);
  431. /**
  432. * Deinstantiate a AOT module instance, destroy the resources.
  433. *
  434. * @param module_inst the AOT module instance to destroy
  435. * @param is_sub_inst the flag of sub instance
  436. */
  437. void
  438. aot_deinstantiate(AOTModuleInstance *module_inst, bool is_sub_inst);
  439. /**
  440. * Lookup an exported function in the AOT module instance.
  441. *
  442. * @param module_inst the module instance
  443. * @param name the name of the function
  444. * @param signature the signature of the function, use "i32"/"i64"/"f32"/"f64"
  445. * to represent the type of i32/i64/f32/f64, e.g. "(i32i64)" "(i32)f32"
  446. *
  447. * @return the function instance found
  448. */
  449. AOTFunctionInstance *
  450. aot_lookup_function(const AOTModuleInstance *module_inst, const char *name,
  451. const char *signature);
  452. /**
  453. * Call the given AOT function of a AOT module instance with
  454. * arguments.
  455. *
  456. * @param exec_env the execution environment
  457. * @param function the function to be called
  458. * @param argc the number of arguments
  459. * @param argv the arguments. If the function method has return value,
  460. * the first (or first two in case 64-bit return value) element of
  461. * argv stores the return value of the called AOT function after this
  462. * function returns.
  463. *
  464. * @return true if success, false otherwise and exception will be thrown,
  465. * the caller can call aot_get_exception to get exception info.
  466. */
  467. bool
  468. aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
  469. unsigned argc, uint32 argv[]);
  470. bool
  471. aot_create_exec_env_and_call_function(AOTModuleInstance *module_inst,
  472. AOTFunctionInstance *function,
  473. unsigned argc, uint32 argv[]);
  474. bool
  475. aot_create_exec_env_singleton(AOTModuleInstance *module_inst);
  476. /**
  477. * Set AOT module instance exception with exception string
  478. *
  479. * @param module the AOT module instance
  480. *
  481. * @param exception current exception string
  482. */
  483. void
  484. aot_set_exception(AOTModuleInstance *module_inst, const char *exception);
  485. void
  486. aot_set_exception_with_id(AOTModuleInstance *module_inst, uint32 id);
  487. /**
  488. * Get exception info of the AOT module instance.
  489. *
  490. * @param module_inst the AOT module instance
  491. *
  492. * @return the exception string
  493. */
  494. const char *
  495. aot_get_exception(AOTModuleInstance *module_inst);
  496. /**
  497. * Clear exception info of the AOT module instance.
  498. *
  499. * @param module_inst the AOT module instance
  500. */
  501. void
  502. aot_clear_exception(AOTModuleInstance *module_inst);
  503. uint32
  504. aot_module_malloc(AOTModuleInstance *module_inst, uint32 size,
  505. void **p_native_addr);
  506. uint32
  507. aot_module_realloc(AOTModuleInstance *module_inst, uint32 ptr, uint32 size,
  508. void **p_native_addr);
  509. void
  510. aot_module_free(AOTModuleInstance *module_inst, uint32 ptr);
  511. uint32
  512. aot_module_dup_data(AOTModuleInstance *module_inst, const char *src,
  513. uint32 size);
  514. bool
  515. aot_validate_app_addr(AOTModuleInstance *module_inst, uint32 app_offset,
  516. uint32 size);
  517. bool
  518. aot_validate_native_addr(AOTModuleInstance *module_inst, void *native_ptr,
  519. uint32 size);
  520. void *
  521. aot_addr_app_to_native(AOTModuleInstance *module_inst, uint32 app_offset);
  522. uint32
  523. aot_addr_native_to_app(AOTModuleInstance *module_inst, void *native_ptr);
  524. bool
  525. aot_get_app_addr_range(AOTModuleInstance *module_inst, uint32 app_offset,
  526. uint32 *p_app_start_offset, uint32 *p_app_end_offset);
  527. bool
  528. aot_get_native_addr_range(AOTModuleInstance *module_inst, uint8 *native_ptr,
  529. uint8 **p_native_start_addr,
  530. uint8 **p_native_end_addr);
  531. bool
  532. aot_enlarge_memory(AOTModuleInstance *module_inst, uint32 inc_page_count);
  533. /**
  534. * Compare whether two wasm types are equal according to the indexs
  535. *
  536. * @param module_inst the AOT module instance
  537. * @param type1_idx index of the first wasm type
  538. * @param type2_idx index of the second wasm type
  539. *
  540. * @return true if equal, false otherwise
  541. */
  542. bool
  543. aot_is_wasm_type_equal(AOTModuleInstance *module_inst, uint32 type1_idx,
  544. uint32 type2_idx);
  545. /**
  546. * Invoke native function from aot code
  547. */
  548. bool
  549. aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
  550. uint32 *argv);
  551. bool
  552. aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
  553. uint32 argc, uint32 *argv);
  554. uint32
  555. aot_get_plt_table_size();
  556. void *
  557. aot_memmove(void *dest, const void *src, size_t n);
  558. void *
  559. aot_memset(void *s, int c, size_t n);
  560. #if WASM_ENABLE_BULK_MEMORY != 0
  561. bool
  562. aot_memory_init(AOTModuleInstance *module_inst, uint32 seg_index, uint32 offset,
  563. uint32 len, uint32 dst);
  564. bool
  565. aot_data_drop(AOTModuleInstance *module_inst, uint32 seg_index);
  566. #endif
  567. #if WASM_ENABLE_THREAD_MGR != 0
  568. bool
  569. aot_set_aux_stack(WASMExecEnv *exec_env, uint32 start_offset, uint32 size);
  570. bool
  571. aot_get_aux_stack(WASMExecEnv *exec_env, uint32 *start_offset, uint32 *size);
  572. #endif
  573. #ifdef OS_ENABLE_HW_BOUND_CHECK
  574. bool
  575. aot_signal_init();
  576. void
  577. aot_signal_destroy();
  578. #endif
  579. void
  580. aot_get_module_mem_consumption(const AOTModule *module,
  581. WASMModuleMemConsumption *mem_conspn);
  582. void
  583. aot_get_module_inst_mem_consumption(const AOTModuleInstance *module_inst,
  584. WASMModuleInstMemConsumption *mem_conspn);
  585. #if WASM_ENABLE_REF_TYPES != 0
  586. void
  587. aot_drop_table_seg(AOTModuleInstance *module_inst, uint32 tbl_seg_idx);
  588. void
  589. aot_table_init(AOTModuleInstance *module_inst, uint32 tbl_idx,
  590. uint32 tbl_seg_idx, uint32 length, uint32 src_offset,
  591. uint32 dst_offset);
  592. void
  593. aot_table_copy(AOTModuleInstance *module_inst, uint32 src_tbl_idx,
  594. uint32 dst_tbl_idx, uint32 length, uint32 src_offset,
  595. uint32 dst_offset);
  596. void
  597. aot_table_fill(AOTModuleInstance *module_inst, uint32 tbl_idx, uint32 length,
  598. uint32 val, uint32 data_offset);
  599. uint32
  600. aot_table_grow(AOTModuleInstance *module_inst, uint32 tbl_idx,
  601. uint32 inc_entries, uint32 init_val);
  602. #endif
  603. AOTTableInstance *
  604. aot_next_tbl_inst(const AOTTableInstance *tbl_inst);
  605. bool
  606. aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index);
  607. void
  608. aot_free_frame(WASMExecEnv *exec_env);
  609. void
  610. aot_dump_call_stack(WASMExecEnv *exec_env);
  611. void
  612. aot_dump_perf_profiling(const AOTModuleInstance *module_inst);
  613. #ifdef __cplusplus
  614. } /* end of extern "C" */
  615. #endif
  616. #endif /* end of _AOT_RUNTIME_H_ */