wasm_runtime.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _WASM_RUNTIME_H
  6. #define _WASM_RUNTIME_H
  7. #include "wasm.h"
  8. #include "bh_hashmap.h"
  9. #include "../common/wasm_runtime_common.h"
  10. #include "../common/wasm_exec_env.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. typedef struct WASMModuleInstance WASMModuleInstance;
  15. typedef struct WASMFunctionInstance WASMFunctionInstance;
  16. typedef struct WASMMemoryInstance WASMMemoryInstance;
  17. typedef struct WASMTableInstance WASMTableInstance;
  18. typedef struct WASMGlobalInstance WASMGlobalInstance;
  19. /**
  20. * When LLVM JIT, WAMR compiler or AOT is enabled, we should ensure that
  21. * some offsets of the same field in the interpreter module instance and
  22. * aot module instance are the same, so that the LLVM JITed/AOTed code
  23. * can smoothly access the interpreter module instance.
  24. * Same for the memory instance and table instance.
  25. * We use the macro DefPointer to define some related pointer fields.
  26. */
  27. #if (WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 \
  28. || WASM_ENABLE_AOT != 0) \
  29. && UINTPTR_MAX == UINT32_MAX
  30. /* Add u32 padding if LLVM JIT, WAMR compiler or AOT is enabled on
  31. 32-bit platform */
  32. #define DefPointer(type, field) \
  33. type field; \
  34. uint32 field##_padding
  35. #else
  36. #define DefPointer(type, field) type field
  37. #endif
  38. typedef enum WASMExceptionID {
  39. EXCE_UNREACHABLE = 0,
  40. EXCE_OUT_OF_MEMORY,
  41. EXCE_OUT_OF_BOUNDS_MEMORY_ACCESS,
  42. EXCE_INTEGER_OVERFLOW,
  43. EXCE_INTEGER_DIVIDE_BY_ZERO,
  44. EXCE_INVALID_CONVERSION_TO_INTEGER,
  45. EXCE_INVALID_FUNCTION_TYPE_INDEX,
  46. EXCE_INVALID_FUNCTION_INDEX,
  47. EXCE_UNDEFINED_ELEMENT,
  48. EXCE_UNINITIALIZED_ELEMENT,
  49. EXCE_CALL_UNLINKED_IMPORT_FUNC,
  50. EXCE_NATIVE_STACK_OVERFLOW,
  51. EXCE_UNALIGNED_ATOMIC,
  52. EXCE_AUX_STACK_OVERFLOW,
  53. EXCE_AUX_STACK_UNDERFLOW,
  54. EXCE_OUT_OF_BOUNDS_TABLE_ACCESS,
  55. EXCE_OPERAND_STACK_OVERFLOW,
  56. EXCE_ALREADY_THROWN,
  57. EXCE_NUM,
  58. } WASMExceptionID;
  59. typedef union {
  60. uint64 u64;
  61. uint32 u32[2];
  62. } MemBound;
  63. struct WASMMemoryInstance {
  64. /* Module type */
  65. uint32 module_type;
  66. /* Shared memory flag */
  67. bool is_shared;
  68. /* Number bytes per page */
  69. uint32 num_bytes_per_page;
  70. /* Current page count */
  71. uint32 cur_page_count;
  72. /* Maximum page count */
  73. uint32 max_page_count;
  74. /* Memory data size */
  75. uint32 memory_data_size;
  76. /**
  77. * Memory data begin address, Note:
  78. * the app-heap might be inserted in to the linear memory,
  79. * when memory is re-allocated, the heap data and memory data
  80. * must be copied to new memory also
  81. */
  82. DefPointer(uint8 *, memory_data);
  83. /* Memory data end address */
  84. DefPointer(uint8 *, memory_data_end);
  85. /* Heap data base address */
  86. DefPointer(uint8 *, heap_data);
  87. /* Heap data end address */
  88. DefPointer(uint8 *, heap_data_end);
  89. /* The heap created */
  90. DefPointer(void *, heap_handle);
  91. #if WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
  92. || WASM_ENABLE_WAMR_COMPILER != 0 || WASM_ENABLE_AOT != 0
  93. MemBound mem_bound_check_1byte;
  94. MemBound mem_bound_check_2bytes;
  95. MemBound mem_bound_check_4bytes;
  96. MemBound mem_bound_check_8bytes;
  97. MemBound mem_bound_check_16bytes;
  98. #endif
  99. };
  100. struct WASMTableInstance {
  101. /* Current size */
  102. uint32 cur_size;
  103. /* Maximum size */
  104. uint32 max_size;
  105. /* Table elements */
  106. uint32 elems[1];
  107. };
  108. struct WASMGlobalInstance {
  109. /* value type, VALUE_TYPE_I32/I64/F32/F64 */
  110. uint8 type;
  111. /* mutable or constant */
  112. bool is_mutable;
  113. /* data offset to base_addr of WASMMemoryInstance */
  114. uint32 data_offset;
  115. /* initial value */
  116. WASMValue initial_value;
  117. #if WASM_ENABLE_MULTI_MODULE != 0
  118. /* just for import, keep the reference here */
  119. WASMModuleInstance *import_module_inst;
  120. WASMGlobalInstance *import_global_inst;
  121. #endif
  122. };
  123. struct WASMFunctionInstance {
  124. /* whether it is import function or WASM function */
  125. bool is_import_func;
  126. /* parameter count */
  127. uint16 param_count;
  128. /* local variable count, 0 for import function */
  129. uint16 local_count;
  130. /* cell num of parameters */
  131. uint16 param_cell_num;
  132. /* cell num of return type */
  133. uint16 ret_cell_num;
  134. /* cell num of local variables, 0 for import function */
  135. uint16 local_cell_num;
  136. #if WASM_ENABLE_FAST_INTERP != 0
  137. /* cell num of consts */
  138. uint16 const_cell_num;
  139. #endif
  140. uint16 *local_offsets;
  141. /* parameter types */
  142. uint8 *param_types;
  143. /* local types, NULL for import function */
  144. uint8 *local_types;
  145. union {
  146. WASMFunctionImport *func_import;
  147. WASMFunction *func;
  148. } u;
  149. #if WASM_ENABLE_MULTI_MODULE != 0
  150. WASMModuleInstance *import_module_inst;
  151. WASMFunctionInstance *import_func_inst;
  152. #endif
  153. #if WASM_ENABLE_PERF_PROFILING != 0
  154. /* total execution time */
  155. uint64 total_exec_time;
  156. /* total execution count */
  157. uint32 total_exec_cnt;
  158. #endif
  159. };
  160. typedef struct WASMExportFuncInstance {
  161. char *name;
  162. WASMFunctionInstance *function;
  163. } WASMExportFuncInstance;
  164. typedef struct WASMExportGlobInstance {
  165. char *name;
  166. WASMGlobalInstance *global;
  167. } WASMExportGlobInstance;
  168. typedef struct WASMExportTabInstance {
  169. char *name;
  170. WASMTableInstance *table;
  171. } WASMExportTabInstance;
  172. typedef struct WASMExportMemInstance {
  173. char *name;
  174. WASMMemoryInstance *memory;
  175. } WASMExportMemInstance;
  176. /* wasm-c-api import function info */
  177. typedef struct CApiFuncImport {
  178. /* host func pointer after linked */
  179. void *func_ptr_linked;
  180. /* whether the host func has env argument */
  181. bool with_env_arg;
  182. /* the env argument of the host func */
  183. void *env_arg;
  184. } CApiFuncImport;
  185. /* Extra info of WASM module instance for interpreter/jit mode */
  186. typedef struct WASMModuleInstanceExtra {
  187. WASMGlobalInstance *globals;
  188. WASMFunctionInstance *functions;
  189. uint32 global_count;
  190. uint32 function_count;
  191. WASMFunctionInstance *start_function;
  192. WASMFunctionInstance *malloc_function;
  193. WASMFunctionInstance *free_function;
  194. WASMFunctionInstance *retain_function;
  195. CApiFuncImport *c_api_func_imports;
  196. #if WASM_ENABLE_SHARED_MEMORY != 0
  197. /* lock for shared memory atomic operations */
  198. korp_mutex mem_lock;
  199. bool mem_lock_inited;
  200. #endif
  201. #if WASM_ENABLE_MULTI_MODULE != 0
  202. bh_list sub_module_inst_list_head;
  203. bh_list *sub_module_inst_list;
  204. /* linked table instances of import table instances */
  205. WASMTableInstance **table_insts_linked;
  206. #endif
  207. #if WASM_ENABLE_MEMORY_PROFILING != 0
  208. uint32 max_aux_stack_used;
  209. #endif
  210. } WASMModuleInstanceExtra;
  211. struct AOTFuncPerfProfInfo;
  212. struct WASMModuleInstance {
  213. /* Module instance type, for module instance loaded from
  214. WASM bytecode binary, this field is Wasm_Module_Bytecode;
  215. for module instance loaded from AOT file, this field is
  216. Wasm_Module_AoT, and this structure should be treated as
  217. AOTModuleInstance structure. */
  218. uint32 module_type;
  219. uint32 memory_count;
  220. DefPointer(WASMMemoryInstance **, memories);
  221. /* global and table info */
  222. uint32 global_data_size;
  223. uint32 table_count;
  224. DefPointer(uint8 *, global_data);
  225. /* For AOTModuleInstance, it denotes `AOTTableInstance *` */
  226. DefPointer(WASMTableInstance **, tables);
  227. /* import func ptrs + llvm jit func ptrs */
  228. DefPointer(void **, func_ptrs);
  229. /* function type indexes */
  230. DefPointer(uint32 *, func_type_indexes);
  231. uint32 export_func_count;
  232. uint32 export_global_count;
  233. uint32 export_memory_count;
  234. uint32 export_table_count;
  235. /* For AOTModuleInstance, it denotes `AOTFunctionInstance *` */
  236. DefPointer(WASMExportFuncInstance *, export_functions);
  237. DefPointer(WASMExportGlobInstance *, export_globals);
  238. DefPointer(WASMExportMemInstance *, export_memories);
  239. DefPointer(WASMExportTabInstance *, export_tables);
  240. /* The exception buffer of wasm interpreter for current thread. */
  241. char cur_exception[128];
  242. /* The WASM module or AOT module, for AOTModuleInstance,
  243. it denotes `AOTModule *` */
  244. DefPointer(WASMModule *, module);
  245. #if WASM_ENABLE_LIBC_WASI
  246. /* WASI context */
  247. DefPointer(WASIContext *, wasi_ctx);
  248. #else
  249. DefPointer(void *, wasi_ctx);
  250. #endif
  251. DefPointer(WASMExecEnv *, exec_env_singleton);
  252. /* Array of function pointers to import functions,
  253. not available in AOTModuleInstance */
  254. DefPointer(void **, import_func_ptrs);
  255. /* Array of function pointers to fast jit functions,
  256. not available in AOTModuleInstance */
  257. DefPointer(void **, fast_jit_func_ptrs);
  258. /* The custom data that can be set/get by wasm_{get|set}_custom_data */
  259. DefPointer(void *, custom_data);
  260. /* Stack frames, used in call stack dump and perf profiling */
  261. DefPointer(Vector *, frames);
  262. /* Function performance profiling info list, only available
  263. in AOTModuleInstance */
  264. DefPointer(struct AOTFuncPerfProfInfo *, func_perf_profilings);
  265. /* WASM/AOT module extra info, for AOTModuleInstance,
  266. it denotes `AOTModuleInstanceExtra *` */
  267. DefPointer(WASMModuleInstanceExtra *, e);
  268. /* Default WASM operand stack size */
  269. uint32 default_wasm_stack_size;
  270. uint32 reserved[3];
  271. /*
  272. * +------------------------------+ <-- memories
  273. * | WASMMemoryInstance[mem_count], mem_count is always 1 for LLVM JIT/AOT
  274. * +------------------------------+ <-- global_data
  275. * | global data
  276. * +------------------------------+ <-- tables
  277. * | WASMTableInstance[table_count]
  278. * +------------------------------+ <-- e
  279. * | WASMModuleInstanceExtra
  280. * +------------------------------+
  281. */
  282. union {
  283. uint64 _make_it_8_byte_aligned_;
  284. WASMMemoryInstance memory_instances[1];
  285. uint8 bytes[1];
  286. } global_table_data;
  287. };
  288. struct WASMInterpFrame;
  289. typedef struct WASMInterpFrame WASMRuntimeFrame;
  290. #if WASM_ENABLE_MULTI_MODULE != 0
  291. typedef struct WASMSubModInstNode {
  292. bh_list_link l;
  293. /* point to a string pool */
  294. const char *module_name;
  295. WASMModuleInstance *module_inst;
  296. } WASMSubModInstNode;
  297. #endif
  298. /**
  299. * Return the code block of a function.
  300. *
  301. * @param func the WASM function instance
  302. *
  303. * @return the code block of the function
  304. */
  305. static inline uint8 *
  306. wasm_get_func_code(WASMFunctionInstance *func)
  307. {
  308. #if WASM_ENABLE_FAST_INTERP == 0
  309. return func->is_import_func ? NULL : func->u.func->code;
  310. #else
  311. return func->is_import_func ? NULL : func->u.func->code_compiled;
  312. #endif
  313. }
  314. /**
  315. * Return the code block end of a function.
  316. *
  317. * @param func the WASM function instance
  318. *
  319. * @return the code block end of the function
  320. */
  321. static inline uint8 *
  322. wasm_get_func_code_end(WASMFunctionInstance *func)
  323. {
  324. #if WASM_ENABLE_FAST_INTERP == 0
  325. return func->is_import_func ? NULL
  326. : func->u.func->code + func->u.func->code_size;
  327. #else
  328. return func->is_import_func
  329. ? NULL
  330. : func->u.func->code_compiled + func->u.func->code_compiled_size;
  331. #endif
  332. }
  333. WASMModule *
  334. wasm_load(uint8 *buf, uint32 size, char *error_buf, uint32 error_buf_size);
  335. WASMModule *
  336. wasm_load_from_sections(WASMSection *section_list, char *error_buf,
  337. uint32 error_buf_size);
  338. void
  339. wasm_unload(WASMModule *module);
  340. WASMModuleInstance *
  341. wasm_instantiate(WASMModule *module, bool is_sub_inst, uint32 stack_size,
  342. uint32 heap_size, char *error_buf, uint32 error_buf_size);
  343. void
  344. wasm_dump_perf_profiling(const WASMModuleInstance *module_inst);
  345. void
  346. wasm_deinstantiate(WASMModuleInstance *module_inst, bool is_sub_inst);
  347. WASMFunctionInstance *
  348. wasm_lookup_function(const WASMModuleInstance *module_inst, const char *name,
  349. const char *signature);
  350. #if WASM_ENABLE_MULTI_MODULE != 0
  351. WASMGlobalInstance *
  352. wasm_lookup_global(const WASMModuleInstance *module_inst, const char *name);
  353. WASMMemoryInstance *
  354. wasm_lookup_memory(const WASMModuleInstance *module_inst, const char *name);
  355. WASMTableInstance *
  356. wasm_lookup_table(const WASMModuleInstance *module_inst, const char *name);
  357. #endif
  358. bool
  359. wasm_call_function(WASMExecEnv *exec_env, WASMFunctionInstance *function,
  360. unsigned argc, uint32 argv[]);
  361. bool
  362. wasm_create_exec_env_and_call_function(WASMModuleInstance *module_inst,
  363. WASMFunctionInstance *function,
  364. unsigned argc, uint32 argv[]);
  365. void
  366. wasm_set_exception(WASMModuleInstance *module, const char *exception);
  367. void
  368. wasm_set_exception_with_id(WASMModuleInstance *module_inst, uint32 id);
  369. const char *
  370. wasm_get_exception(WASMModuleInstance *module);
  371. uint32
  372. wasm_module_malloc(WASMModuleInstance *module_inst, uint32 size,
  373. void **p_native_addr);
  374. uint32
  375. wasm_module_realloc(WASMModuleInstance *module_inst, uint32 ptr, uint32 size,
  376. void **p_native_addr);
  377. void
  378. wasm_module_free(WASMModuleInstance *module_inst, uint32 ptr);
  379. uint32
  380. wasm_module_dup_data(WASMModuleInstance *module_inst, const char *src,
  381. uint32 size);
  382. /**
  383. * Check whether the app address and the buf is inside the linear memory,
  384. * and convert the app address into native address
  385. */
  386. bool
  387. wasm_check_app_addr_and_convert(WASMModuleInstance *module_inst, bool is_str,
  388. uint32 app_buf_addr, uint32 app_buf_size,
  389. void **p_native_addr);
  390. WASMMemoryInstance *
  391. wasm_get_default_memory(WASMModuleInstance *module_inst);
  392. bool
  393. wasm_enlarge_memory(WASMModuleInstance *module_inst, uint32 inc_page_count);
  394. bool
  395. wasm_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
  396. uint32 argc, uint32 argv[]);
  397. #if WASM_ENABLE_THREAD_MGR != 0
  398. bool
  399. wasm_set_aux_stack(WASMExecEnv *exec_env, uint32 start_offset, uint32 size);
  400. bool
  401. wasm_get_aux_stack(WASMExecEnv *exec_env, uint32 *start_offset, uint32 *size);
  402. #endif
  403. void
  404. wasm_get_module_mem_consumption(const WASMModule *module,
  405. WASMModuleMemConsumption *mem_conspn);
  406. void
  407. wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module,
  408. WASMModuleInstMemConsumption *mem_conspn);
  409. #if WASM_ENABLE_REF_TYPES != 0
  410. static inline bool
  411. wasm_elem_is_active(uint32 mode)
  412. {
  413. return (mode & 0x1) == 0x0;
  414. }
  415. static inline bool
  416. wasm_elem_is_passive(uint32 mode)
  417. {
  418. return (mode & 0x1) == 0x1;
  419. }
  420. static inline bool
  421. wasm_elem_is_declarative(uint32 mode)
  422. {
  423. return (mode & 0x3) == 0x3;
  424. }
  425. bool
  426. wasm_enlarge_table(WASMModuleInstance *module_inst, uint32 table_idx,
  427. uint32 inc_entries, uint32 init_val);
  428. #endif /* WASM_ENABLE_REF_TYPES != 0 */
  429. static inline WASMTableInstance *
  430. wasm_get_table_inst(const WASMModuleInstance *module_inst, uint32 tbl_idx)
  431. {
  432. /* careful, it might be a table in another module */
  433. WASMTableInstance *tbl_inst = module_inst->tables[tbl_idx];
  434. #if WASM_ENABLE_MULTI_MODULE != 0
  435. if (tbl_idx < module_inst->module->import_table_count
  436. && module_inst->e->table_insts_linked[tbl_idx]) {
  437. tbl_inst = module_inst->e->table_insts_linked[tbl_idx];
  438. }
  439. #endif
  440. bh_assert(tbl_inst);
  441. return tbl_inst;
  442. }
  443. #if WASM_ENABLE_DUMP_CALL_STACK != 0
  444. bool
  445. wasm_interp_create_call_stack(struct WASMExecEnv *exec_env);
  446. /**
  447. * @brief Dump wasm call stack or get the size
  448. *
  449. * @param exec_env the execution environment
  450. * @param print whether to print to stdout or not
  451. * @param buf buffer to store the dumped content
  452. * @param len length of the buffer
  453. *
  454. * @return when print is true, return the bytes printed out to stdout; when
  455. * print is false and buf is NULL, return the size required to store the
  456. * callstack content; when print is false and buf is not NULL, return the size
  457. * dumped to the buffer, 0 means error and data in buf may be invalid
  458. */
  459. uint32
  460. wasm_interp_dump_call_stack(struct WASMExecEnv *exec_env, bool print, char *buf,
  461. uint32 len);
  462. #endif
  463. const uint8 *
  464. wasm_loader_get_custom_section(WASMModule *module, const char *name,
  465. uint32 *len);
  466. #if WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
  467. || WASM_ENABLE_WAMR_COMPILER != 0
  468. void
  469. jit_set_exception_with_id(WASMModuleInstance *module_inst, uint32 id);
  470. /**
  471. * Check whether the app address and the buf is inside the linear memory,
  472. * and convert the app address into native address
  473. */
  474. bool
  475. jit_check_app_addr_and_convert(WASMModuleInstance *module_inst, bool is_str,
  476. uint32 app_buf_addr, uint32 app_buf_size,
  477. void **p_native_addr);
  478. #endif /* end of WASM_ENABLE_FAST_JIT != 0 || WASM_ENABLE_JIT != 0 \
  479. || WASM_ENABLE_WAMR_COMPILER != 0 */
  480. #if WASM_ENABLE_FAST_JIT != 0
  481. bool
  482. fast_jit_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
  483. uint32 type_idx, uint32 argc, uint32 *argv);
  484. bool
  485. fast_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
  486. struct WASMInterpFrame *prev_frame);
  487. #endif
  488. #if WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0
  489. bool
  490. llvm_jit_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 elem_idx,
  491. uint32 argc, uint32 *argv);
  492. bool
  493. llvm_jit_invoke_native(WASMExecEnv *exec_env, uint32 func_idx, uint32 argc,
  494. uint32 *argv);
  495. #if WASM_ENABLE_BULK_MEMORY != 0
  496. bool
  497. llvm_jit_memory_init(WASMModuleInstance *module_inst, uint32 seg_index,
  498. uint32 offset, uint32 len, uint32 dst);
  499. bool
  500. llvm_jit_data_drop(WASMModuleInstance *module_inst, uint32 seg_index);
  501. #endif
  502. #if WASM_ENABLE_REF_TYPES != 0
  503. void
  504. llvm_jit_drop_table_seg(WASMModuleInstance *module_inst, uint32 tbl_seg_idx);
  505. void
  506. llvm_jit_table_init(WASMModuleInstance *module_inst, uint32 tbl_idx,
  507. uint32 tbl_seg_idx, uint32 length, uint32 src_offset,
  508. uint32 dst_offset);
  509. void
  510. llvm_jit_table_copy(WASMModuleInstance *module_inst, uint32 src_tbl_idx,
  511. uint32 dst_tbl_idx, uint32 length, uint32 src_offset,
  512. uint32 dst_offset);
  513. void
  514. llvm_jit_table_fill(WASMModuleInstance *module_inst, uint32 tbl_idx,
  515. uint32 length, uint32 val, uint32 data_offset);
  516. uint32
  517. llvm_jit_table_grow(WASMModuleInstance *module_inst, uint32 tbl_idx,
  518. uint32 inc_entries, uint32 init_val);
  519. #endif
  520. #if WASM_ENABLE_DUMP_CALL_STACK != 0 || WASM_ENABLE_PERF_PROFILING != 0
  521. bool
  522. llvm_jit_alloc_frame(WASMExecEnv *exec_env, uint32 func_index);
  523. void
  524. llvm_jit_free_frame(WASMExecEnv *exec_env);
  525. #endif
  526. #endif /* end of WASM_ENABLE_JIT != 0 || WASM_ENABLE_WAMR_COMPILER != 0 */
  527. #ifdef __cplusplus
  528. }
  529. #endif
  530. #endif /* end of _WASM_RUNTIME_H */