WAMR User APIs
wasm_export.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Intel Corporation. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4  */
5 
13 #ifndef _WASM_EXPORT_H
14 #define _WASM_EXPORT_H
15 
16 #include <stdint.h>
17 #include <stdbool.h>
18 #include "lib_export.h"
19 
20 #ifndef WASM_RUNTIME_API_EXTERN
21 #if defined(_MSC_BUILD)
22 #if defined(COMPILING_WASM_RUNTIME_API)
23 #define WASM_RUNTIME_API_EXTERN __declspec(dllexport)
24 #else
25 #define WASM_RUNTIME_API_EXTERN __declspec(dllimport)
26 #endif
27 #else
28 #define WASM_RUNTIME_API_EXTERN
29 #endif
30 #endif
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /* clang-format off */
37 
38 #define get_module_inst(exec_env) \
39  wasm_runtime_get_module_inst(exec_env)
40 
41 #define validate_app_addr(offset, size) \
42  wasm_runtime_validate_app_addr(module_inst, offset, size)
43 
44 #define validate_app_str_addr(offset) \
45  wasm_runtime_validate_app_str_addr(module_inst, offset)
46 
47 #define addr_app_to_native(offset) \
48  wasm_runtime_addr_app_to_native(module_inst, offset)
49 
50 #define addr_native_to_app(ptr) \
51  wasm_runtime_addr_native_to_app(module_inst, ptr)
52 
53 #define module_malloc(size, p_native_addr) \
54  wasm_runtime_module_malloc(module_inst, size, p_native_addr)
55 
56 #define module_free(offset) \
57  wasm_runtime_module_free(module_inst, offset)
58 
59 #define native_raw_return_type(type, args) type *raw_ret = (type *)(args)
60 
61 #define native_raw_get_arg(type, name, args) type name = *((type *)(args++))
62 
63 #define native_raw_set_return(val) *raw_ret = (val)
64 
65 #ifndef WASM_MODULE_T_DEFINED
66 #define WASM_MODULE_T_DEFINED
67 /* Uninstantiated WASM module loaded from WASM binary file
68  or AoT binary file*/
69 struct WASMModuleCommon;
70 typedef struct WASMModuleCommon *wasm_module_t;
71 #endif
72 
73 /* Instantiated WASM module */
74 struct WASMModuleInstanceCommon;
75 typedef struct WASMModuleInstanceCommon *wasm_module_inst_t;
76 
77 /* Function instance */
78 typedef void WASMFunctionInstanceCommon;
79 typedef WASMFunctionInstanceCommon *wasm_function_inst_t;
80 
81 /* WASM section */
82 typedef struct wasm_section_t {
83  struct wasm_section_t *next;
84  /* section type */
85  int section_type;
86  /* section body, not include type and size */
87  uint8_t *section_body;
88  /* section body size */
89  uint32_t section_body_size;
91 
92 /* Execution environment, e.g. stack info */
93 struct WASMExecEnv;
94 typedef struct WASMExecEnv *wasm_exec_env_t;
95 
96 /* Package Type */
97 typedef enum {
98  Wasm_Module_Bytecode = 0,
99  Wasm_Module_AoT,
100  Package_Type_Unknown = 0xFFFF
101 } package_type_t;
102 
103 #ifndef MEM_ALLOC_OPTION_DEFINED
104 #define MEM_ALLOC_OPTION_DEFINED
105 /* Memory allocator type */
106 typedef enum {
107  /* pool mode, allocate memory from user defined heap buffer */
108  Alloc_With_Pool = 0,
109  /* user allocator mode, allocate memory from user defined
110  malloc function */
111  Alloc_With_Allocator,
112  /* system allocator mode, allocate memory from system allocator,
113  or, platform's os_malloc function */
114  Alloc_With_System_Allocator,
115 } mem_alloc_type_t;
116 
117 /* Memory allocator option */
118 typedef union MemAllocOption {
119  struct {
120  void *heap_buf;
121  uint32_t heap_size;
122  } pool;
123  struct {
124  void *malloc_func;
125  void *realloc_func;
126  void *free_func;
127  /* allocator user data, only used when
128  WASM_MEM_ALLOC_WITH_USER_DATA is defined */
129  void *user_data;
130  } allocator;
132 #endif
133 
134 /* Memory pool info */
135 typedef struct mem_alloc_info_t {
136  uint32_t total_size;
137  uint32_t total_free_size;
138  uint32_t highmark_size;
140 
141 /* Running mode of runtime and module instance*/
142 typedef enum RunningMode {
143  Mode_Interp = 1,
144  Mode_Fast_JIT,
145  Mode_LLVM_JIT,
146  Mode_Multi_Tier_JIT,
147 } RunningMode;
148 
149 /* WASM runtime initialize arguments */
150 typedef struct RuntimeInitArgs {
151  mem_alloc_type_t mem_alloc_type;
152  MemAllocOption mem_alloc_option;
153 
154  const char *native_module_name;
155  NativeSymbol *native_symbols;
156  uint32_t n_native_symbols;
157 
158  /* maximum thread number, only used when
159  WASM_ENABLE_THREAD_MGR is defined */
160  uint32_t max_thread_num;
161 
162  /* Debug settings, only used when
163  WASM_ENABLE_DEBUG_INTERP != 0 */
164  char ip_addr[128];
165  int unused; /* was platform_port */
166  int instance_port;
167 
168  /* Fast JIT code cache size */
169  uint32_t fast_jit_code_cache_size;
170 
171  /* Default GC heap size */
172  uint32_t gc_heap_size;
173 
174  /* Default running mode of the runtime */
175  RunningMode running_mode;
176 
177  /* LLVM JIT opt and size level */
178  uint32_t llvm_jit_opt_level;
179  uint32_t llvm_jit_size_level;
180  /* Segue optimization flags for LLVM JIT */
181  uint32_t segue_flags;
192 
193 #ifndef INSTANTIATION_ARGS_OPTION_DEFINED
194 #define INSTANTIATION_ARGS_OPTION_DEFINED
195 /* WASM module instantiation arguments */
196 typedef struct InstantiationArgs {
197  uint32_t default_stack_size;
198  uint32_t host_managed_heap_size;
199  uint32_t max_memory_pages;
201 #endif /* INSTANTIATION_ARGS_OPTION_DEFINED */
202 
203 #ifndef WASM_VALKIND_T_DEFINED
204 #define WASM_VALKIND_T_DEFINED
205 typedef uint8_t wasm_valkind_t;
206 enum wasm_valkind_enum {
207  WASM_I32,
208  WASM_I64,
209  WASM_F32,
210  WASM_F64,
211  WASM_ANYREF = 128,
212  WASM_FUNCREF,
213 };
214 #endif
215 
216 #ifndef WASM_VAL_T_DEFINED
217 #define WASM_VAL_T_DEFINED
218 struct wasm_ref_t;
219 
220 typedef struct wasm_val_t {
221  wasm_valkind_t kind;
222  uint8_t __paddings[7];
223  union {
224  /* also represent a function index */
225  int32_t i32;
226  int64_t i64;
227  float f32;
228  double f64;
229  /* represent a foreign object, aka externref in .wat */
230  uintptr_t foreign;
231  struct wasm_ref_t *ref;
232  } of;
233 } wasm_val_t;
234 #endif
235 
236 typedef enum {
237  WASM_LOG_LEVEL_FATAL = 0,
238  WASM_LOG_LEVEL_ERROR = 1,
239  WASM_LOG_LEVEL_WARNING = 2,
240  WASM_LOG_LEVEL_DEBUG = 3,
241  WASM_LOG_LEVEL_VERBOSE = 4
242 } log_level_t;
243 
251 WASM_RUNTIME_API_EXTERN bool
252 wasm_runtime_init(void);
253 
263 WASM_RUNTIME_API_EXTERN bool
265 
271 WASM_RUNTIME_API_EXTERN void
272 wasm_runtime_set_log_level(log_level_t level);
273 
281 WASM_RUNTIME_API_EXTERN bool
282 wasm_runtime_is_running_mode_supported(RunningMode running_mode);
283 
293 WASM_RUNTIME_API_EXTERN bool
294 wasm_runtime_set_default_running_mode(RunningMode running_mode);
295 
299 WASM_RUNTIME_API_EXTERN void
301 
309 WASM_RUNTIME_API_EXTERN void *
310 wasm_runtime_malloc(unsigned int size);
311 
320 WASM_RUNTIME_API_EXTERN void *
321 wasm_runtime_realloc(void *ptr, unsigned int size);
322 
323 /*
324  * Free memory to runtime memory environment.
325  */
326 WASM_RUNTIME_API_EXTERN void
327 wasm_runtime_free(void *ptr);
328 
329 /*
330  * Get memory info, only pool mode is supported now.
331  */
332 WASM_RUNTIME_API_EXTERN bool
333 wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
334 
343 WASM_RUNTIME_API_EXTERN package_type_t
344 get_package_type(const uint8_t *buf, uint32_t size);
345 
354 WASM_RUNTIME_API_EXTERN bool
355 wasm_runtime_is_xip_file(const uint8_t *buf, uint32_t size);
356 
360 typedef bool (*module_reader)(package_type_t module_type,
361  const char *module_name,
362  uint8_t **p_buffer, uint32_t *p_size);
363 
367 typedef void (*module_destroyer)(uint8_t *buffer, uint32_t size);
368 
375 WASM_RUNTIME_API_EXTERN void
377  const module_destroyer destroyer);
389 WASM_RUNTIME_API_EXTERN bool
390 wasm_runtime_register_module(const char *module_name, wasm_module_t module,
391  char *error_buf, uint32_t error_buf_size);
392 
401 WASM_RUNTIME_API_EXTERN wasm_module_t
402 wasm_runtime_find_module_registered(const char *module_name);
403 
425 WASM_RUNTIME_API_EXTERN wasm_module_t
426 wasm_runtime_load(uint8_t *buf, uint32_t size,
427  char *error_buf, uint32_t error_buf_size);
428 
439 WASM_RUNTIME_API_EXTERN wasm_module_t
440 wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot,
441  char *error_buf, uint32_t error_buf_size);
442 
448 WASM_RUNTIME_API_EXTERN void
449 wasm_runtime_unload(wasm_module_t module);
450 
459 char *
460 wasm_runtime_get_module_hash(wasm_module_t module);
461 
495 WASM_RUNTIME_API_EXTERN void
496 wasm_runtime_set_wasi_args_ex(wasm_module_t module,
497  const char *dir_list[], uint32_t dir_count,
498  const char *map_dir_list[], uint32_t map_dir_count,
499  const char *env[], uint32_t env_count,
500  char *argv[], int argc, int64_t stdinfd,
501  int64_t stdoutfd, int64_t stderrfd);
502 
508 WASM_RUNTIME_API_EXTERN void
509 wasm_runtime_set_wasi_args(wasm_module_t module,
510  const char *dir_list[], uint32_t dir_count,
511  const char *map_dir_list[], uint32_t map_dir_count,
512  const char *env[], uint32_t env_count,
513  char *argv[], int argc);
514 
515 WASM_RUNTIME_API_EXTERN void
516 wasm_runtime_set_wasi_addr_pool(wasm_module_t module, const char *addr_pool[],
517  uint32_t addr_pool_size);
518 
519 WASM_RUNTIME_API_EXTERN void
520 wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module, const char *ns_lookup_pool[],
521  uint32_t ns_lookup_pool_size);
522 
542 WASM_RUNTIME_API_EXTERN wasm_module_inst_t
543 wasm_runtime_instantiate(const wasm_module_t module,
544  uint32_t default_stack_size, uint32_t host_managed_heap_size,
545  char *error_buf, uint32_t error_buf_size);
546 
552 WASM_RUNTIME_API_EXTERN wasm_module_inst_t
553 wasm_runtime_instantiate_ex(const wasm_module_t module,
554  const InstantiationArgs *args,
555  char *error_buf, uint32_t error_buf_size);
556 
568 WASM_RUNTIME_API_EXTERN bool
569 wasm_runtime_set_running_mode(wasm_module_inst_t module_inst,
570  RunningMode running_mode);
571 
582 WASM_RUNTIME_API_EXTERN RunningMode
583 wasm_runtime_get_running_mode(wasm_module_inst_t module_inst);
584 
590 WASM_RUNTIME_API_EXTERN void
591 wasm_runtime_deinstantiate(wasm_module_inst_t module_inst);
592 
600 WASM_RUNTIME_API_EXTERN wasm_module_t
601 wasm_runtime_get_module(wasm_module_inst_t module_inst);
602 
603 WASM_RUNTIME_API_EXTERN bool
604 wasm_runtime_is_wasi_mode(wasm_module_inst_t module_inst);
605 
606 WASM_RUNTIME_API_EXTERN wasm_function_inst_t
607 wasm_runtime_lookup_wasi_start_function(wasm_module_inst_t module_inst);
608 
618 WASM_RUNTIME_API_EXTERN uint32_t
619 wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
620 
629 WASM_RUNTIME_API_EXTERN wasm_function_inst_t
630 wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
631  const char *name);
632 
641 WASM_RUNTIME_API_EXTERN uint32_t
642 wasm_func_get_param_count(wasm_function_inst_t const func_inst,
643  wasm_module_inst_t const module_inst);
644 
653 WASM_RUNTIME_API_EXTERN uint32_t
654 wasm_func_get_result_count(wasm_function_inst_t const func_inst,
655  wasm_module_inst_t const module_inst);
656 
664 WASM_RUNTIME_API_EXTERN void
665 wasm_func_get_param_types(wasm_function_inst_t const func_inst,
666  wasm_module_inst_t const module_inst,
667  wasm_valkind_t *param_types);
668 
676 WASM_RUNTIME_API_EXTERN void
677 wasm_func_get_result_types(wasm_function_inst_t const func_inst,
678  wasm_module_inst_t const module_inst,
679  wasm_valkind_t *result_types);
680 
690 WASM_RUNTIME_API_EXTERN wasm_exec_env_t
691 wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
692  uint32_t stack_size);
693 
699 WASM_RUNTIME_API_EXTERN void
700 wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
701 
716 WASM_RUNTIME_API_EXTERN wasm_exec_env_t
717 wasm_runtime_get_exec_env_singleton(wasm_module_inst_t module_inst);
718 
739 WASM_RUNTIME_API_EXTERN uint32_t
740 wasm_runtime_start_debug_instance_with_port(wasm_exec_env_t exec_env, int32_t port);
741 
745 WASM_RUNTIME_API_EXTERN uint32_t
746 wasm_runtime_start_debug_instance(wasm_exec_env_t exec_env);
747 
760 WASM_RUNTIME_API_EXTERN bool
762 
766 WASM_RUNTIME_API_EXTERN void
768 
772 WASM_RUNTIME_API_EXTERN bool
774 
782 WASM_RUNTIME_API_EXTERN wasm_module_inst_t
783 wasm_runtime_get_module_inst(wasm_exec_env_t exec_env);
784 
796 WASM_RUNTIME_API_EXTERN void
797 wasm_runtime_set_module_inst(wasm_exec_env_t exec_env,
798  const wasm_module_inst_t module_inst);
799 
820 WASM_RUNTIME_API_EXTERN bool
821 wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
822  wasm_function_inst_t function,
823  uint32_t argc, uint32_t argv[]);
824 
841 WASM_RUNTIME_API_EXTERN bool
842 wasm_runtime_call_wasm_a(wasm_exec_env_t exec_env,
843  wasm_function_inst_t function,
844  uint32_t num_results, wasm_val_t results[],
845  uint32_t num_args, wasm_val_t *args);
846 
863 WASM_RUNTIME_API_EXTERN bool
864 wasm_runtime_call_wasm_v(wasm_exec_env_t exec_env,
865  wasm_function_inst_t function,
866  uint32_t num_results, wasm_val_t results[],
867  uint32_t num_args, ...);
868 
890 WASM_RUNTIME_API_EXTERN bool
891 wasm_runtime_call_indirect(wasm_exec_env_t exec_env, uint32_t element_index,
892  uint32_t argc, uint32_t argv[]);
893 
908 WASM_RUNTIME_API_EXTERN bool
909 wasm_application_execute_main(wasm_module_inst_t module_inst,
910  int32_t argc, char *argv[]);
911 
927 WASM_RUNTIME_API_EXTERN bool
928 wasm_application_execute_func(wasm_module_inst_t module_inst,
929  const char *name, int32_t argc, char *argv[]);
930 
938 WASM_RUNTIME_API_EXTERN const char *
939 wasm_runtime_get_exception(wasm_module_inst_t module_inst);
940 
948 WASM_RUNTIME_API_EXTERN void
949 wasm_runtime_set_exception(wasm_module_inst_t module_inst,
950  const char *exception);
951 
957 WASM_RUNTIME_API_EXTERN void
958 wasm_runtime_clear_exception(wasm_module_inst_t module_inst);
959 
975 WASM_RUNTIME_API_EXTERN void
976 wasm_runtime_terminate(wasm_module_inst_t module_inst);
977 
987 WASM_RUNTIME_API_EXTERN void
988 wasm_runtime_set_custom_data(wasm_module_inst_t module_inst,
989  void *custom_data);
990 
998 WASM_RUNTIME_API_EXTERN void *
999 wasm_runtime_get_custom_data(wasm_module_inst_t module_inst);
1000 
1007 WASM_RUNTIME_API_EXTERN void
1008 wasm_runtime_set_bounds_checks(wasm_module_inst_t module_inst,
1009  bool enable);
1010 
1017 WASM_RUNTIME_API_EXTERN bool
1019  wasm_module_inst_t module_inst);
1020 
1040 WASM_RUNTIME_API_EXTERN uint64_t
1041 wasm_runtime_module_malloc(wasm_module_inst_t module_inst, uint64_t size,
1042  void **p_native_addr);
1043 
1050 WASM_RUNTIME_API_EXTERN void
1051 wasm_runtime_module_free(wasm_module_inst_t module_inst, uint64_t ptr);
1052 
1066 WASM_RUNTIME_API_EXTERN uint64_t
1067 wasm_runtime_module_dup_data(wasm_module_inst_t module_inst,
1068  const char *src, uint64_t size);
1069 
1081 WASM_RUNTIME_API_EXTERN bool
1082 wasm_runtime_validate_app_addr(wasm_module_inst_t module_inst,
1083  uint64_t app_offset, uint64_t size);
1084 
1103 WASM_RUNTIME_API_EXTERN bool
1104 wasm_runtime_validate_app_str_addr(wasm_module_inst_t module_inst,
1105  uint64_t app_str_offset);
1106 
1119 WASM_RUNTIME_API_EXTERN bool
1120 wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
1121  void *native_ptr, uint64_t size);
1122 
1135 WASM_RUNTIME_API_EXTERN void *
1136 wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
1137  uint64_t app_offset);
1138 
1147 WASM_RUNTIME_API_EXTERN uint64_t
1148 wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
1149  void *native_ptr);
1150 
1161 WASM_RUNTIME_API_EXTERN bool
1162 wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst,
1163  uint64_t app_offset,
1164  uint64_t *p_app_start_offset,
1165  uint64_t *p_app_end_offset);
1166 
1180 WASM_RUNTIME_API_EXTERN bool
1181 wasm_runtime_get_native_addr_range(wasm_module_inst_t module_inst,
1182  uint8_t *native_ptr,
1183  uint8_t **p_native_start_addr,
1184  uint8_t **p_native_end_addr);
1185 
1219 WASM_RUNTIME_API_EXTERN bool
1220 wasm_runtime_register_natives(const char *module_name,
1221  NativeSymbol *native_symbols,
1222  uint32_t n_native_symbols);
1223 
1234 WASM_RUNTIME_API_EXTERN bool
1235 wasm_runtime_register_natives_raw(const char *module_name,
1236  NativeSymbol *native_symbols,
1237  uint32_t n_native_symbols);
1238 
1239 
1253 WASM_RUNTIME_API_EXTERN bool
1254 wasm_runtime_unregister_natives(const char *module_name,
1255  NativeSymbol *native_symbols);
1256 
1264 WASM_RUNTIME_API_EXTERN void *
1265 wasm_runtime_get_function_attachment(wasm_exec_env_t exec_env);
1266 
1273 WASM_RUNTIME_API_EXTERN void
1274 wasm_runtime_set_user_data(wasm_exec_env_t exec_env, void *user_data);
1275 
1283 WASM_RUNTIME_API_EXTERN void *
1284 wasm_runtime_get_user_data(wasm_exec_env_t exec_env);
1285 
1295 WASM_RUNTIME_API_EXTERN void
1296 wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env);
1297 
1303 WASM_RUNTIME_API_EXTERN void
1304 wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst);
1305 
1311 WASM_RUNTIME_API_EXTERN double
1312 wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst);
1313 
1322 WASM_RUNTIME_API_EXTERN double
1323 wasm_runtime_get_wasm_func_exec_time(wasm_module_inst_t inst,
1324  const char *func_name);
1325 
1326 /* wasm thread callback function type */
1327 typedef void *(*wasm_thread_callback_t)(wasm_exec_env_t, void *);
1328 /* wasm thread type */
1329 typedef uintptr_t wasm_thread_t;
1330 
1336 WASM_RUNTIME_API_EXTERN void
1337 wasm_runtime_set_max_thread_num(uint32_t num);
1338 
1347 WASM_RUNTIME_API_EXTERN wasm_exec_env_t
1348 wasm_runtime_spawn_exec_env(wasm_exec_env_t exec_env);
1349 
1355 WASM_RUNTIME_API_EXTERN void
1356 wasm_runtime_destroy_spawned_exec_env(wasm_exec_env_t exec_env);
1357 
1368 WASM_RUNTIME_API_EXTERN int32_t
1369 wasm_runtime_spawn_thread(wasm_exec_env_t exec_env, wasm_thread_t *tid,
1370  wasm_thread_callback_t callback, void *arg);
1371 
1380 WASM_RUNTIME_API_EXTERN int32_t
1381 wasm_runtime_join_thread(wasm_thread_t tid, void **retval);
1382 
1394 WASM_RUNTIME_API_EXTERN bool
1395 wasm_externref_obj2ref(wasm_module_inst_t module_inst,
1396  void *extern_obj, uint32_t *p_externref_idx);
1397 
1407 WASM_RUNTIME_API_EXTERN bool
1408 wasm_externref_objdel(wasm_module_inst_t module_inst, void *extern_obj);
1409 
1421 WASM_RUNTIME_API_EXTERN bool
1422 wasm_externref_set_cleanup(wasm_module_inst_t module_inst, void *extern_obj,
1423  void (*extern_obj_cleanup)(void *));
1424 
1434 WASM_RUNTIME_API_EXTERN bool
1435 wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj);
1436 
1446 WASM_RUNTIME_API_EXTERN bool
1447 wasm_externref_retain(uint32_t externref_idx);
1448 
1454 WASM_RUNTIME_API_EXTERN void
1455 wasm_runtime_dump_call_stack(wasm_exec_env_t exec_env);
1456 
1465 WASM_RUNTIME_API_EXTERN uint32_t
1466 wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env);
1467 
1481 WASM_RUNTIME_API_EXTERN uint32_t
1482 wasm_runtime_dump_call_stack_to_buf(wasm_exec_env_t exec_env, char *buf,
1483  uint32_t len);
1484 
1492 WASM_RUNTIME_API_EXTERN uint32_t
1493 wasm_runtime_get_pgo_prof_data_size(wasm_module_inst_t module_inst);
1494 
1505 WASM_RUNTIME_API_EXTERN uint32_t
1506 wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst,
1507  char *buf, uint32_t len);
1508 
1519 WASM_RUNTIME_API_EXTERN const uint8_t *
1520 wasm_runtime_get_custom_section(wasm_module_t const module_comm,
1521  const char *name, uint32_t *len);
1522 
1523 
1527 WASM_RUNTIME_API_EXTERN void
1528 wasm_runtime_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch);
1529 
1534 WASM_RUNTIME_API_EXTERN bool
1535 wasm_runtime_is_import_func_linked(const char *module_name,
1536  const char *func_name);
1537 
1542 WASM_RUNTIME_API_EXTERN bool
1543 wasm_runtime_is_import_global_linked(const char *module_name,
1544  const char *global_name);
1545 
1546 typedef enum {
1547  INTERNAL_ERROR,
1548  MAX_SIZE_REACHED,
1549 } enlarge_memory_error_reason_t;
1550 
1551 typedef void (*enlarge_memory_error_callback_t)(
1552  uint32_t inc_page_count, uint64_t current_memory_size,
1553  uint32_t memory_index, enlarge_memory_error_reason_t failure_reason,
1554  wasm_module_inst_t instance, wasm_exec_env_t exec_env,
1555  void* user_data);
1556 
1560 WASM_RUNTIME_API_EXTERN void
1562  const enlarge_memory_error_callback_t callback, void *user_data);
1563 
1564 /*
1565  * module instance context APIs
1566  * wasm_runtime_create_context_key
1567  * wasm_runtime_destroy_context_key
1568  * wasm_runtime_set_context
1569  * wasm_runtime_set_context_spread
1570  * wasm_runtime_get_context
1571  *
1572  * This set of APIs is intended to be used by an embedder which provides
1573  * extra sets of native functions, which need per module instance state
1574  * and are maintained outside of the WAMR tree.
1575  *
1576  * It's modelled after the pthread specific API.
1577  *
1578  * wasm_runtime_set_context_spread is similar to
1579  * wasm_runtime_set_context, except that
1580  * wasm_runtime_set_context_spread applies the change
1581  * to all threads in the cluster.
1582  * It's an undefined behavior if multiple threads in a cluster call
1583  * wasm_runtime_set_context_spread on the same key
1584  * simultaneously. It's a caller's resposibility to perform necessary
1585  * serialization if necessary. For example:
1586  *
1587  * if (wasm_runtime_get_context(inst, key) == NULL) {
1588  * newctx = alloc_and_init(...);
1589  * lock(some_lock);
1590  * if (wasm_runtime_get_context(inst, key) == NULL) {
1591  * // this thread won the race
1592  * wasm_runtime_set_context_spread(inst, key, newctx);
1593  * newctx = NULL;
1594  * }
1595  * unlock(some_lock);
1596  * if (newctx != NULL) {
1597  * // this thread lost the race, free it
1598  * cleanup_and_free(newctx);
1599  * }
1600  * }
1601  *
1602  * Note: dynamic key create/destroy while instances are live is not
1603  * implemented as of writing this.
1604  * it's caller's resposibility to ensure destorying all module instances
1605  * before calling wasm_runtime_create_context_key or
1606  * wasm_runtime_destroy_context_key.
1607  * otherwise, it's an undefined behavior.
1608  *
1609  * Note about threads:
1610  * - When spawning a thread, the contexts (the pointers given to
1611  * wasm_runtime_set_context) are copied from the parent
1612  * instance.
1613  * - The destructor is called only on the main instance.
1614  */
1615 
1616 WASM_RUNTIME_API_EXTERN void *
1617 wasm_runtime_create_context_key(
1618  void (*dtor)(wasm_module_inst_t inst, void *ctx));
1619 
1620 WASM_RUNTIME_API_EXTERN void
1621 wasm_runtime_destroy_context_key(void *key);
1622 
1623 WASM_RUNTIME_API_EXTERN void
1624 wasm_runtime_set_context(wasm_module_inst_t inst, void *key, void *ctx);
1625 
1626 WASM_RUNTIME_API_EXTERN void
1627 wasm_runtime_set_context_spread(wasm_module_inst_t inst, void *key, void *ctx);
1628 
1629 WASM_RUNTIME_API_EXTERN void *
1630 wasm_runtime_get_context(wasm_module_inst_t inst, void *key);
1631 
1632 /*
1633  * wasm_runtime_begin_blocking_op/wasm_runtime_end_blocking_op
1634  *
1635  * These APIs are intended to be used by the implementations of
1636  * host functions. It wraps an operation which possibly blocks for long
1637  * to prepare for async termination.
1638  *
1639  * For simplicity, we recommend to wrap only the very minimum piece of
1640  * the code with this. Ideally, just a single system call.
1641  *
1642  * eg.
1643  *
1644  * if (!wasm_runtime_begin_blocking_op(exec_env)) {
1645  * return EINTR;
1646  * }
1647  * ret = possibly_blocking_op();
1648  * wasm_runtime_end_blocking_op(exec_env);
1649  * return ret;
1650  *
1651  * If threading support (WASM_ENABLE_THREAD_MGR) is not enabled,
1652  * these functions are no-op.
1653  *
1654  * If the underlying platform support (OS_ENABLE_WAKEUP_BLOCKING_OP) is
1655  * not available, these functions are no-op. In that case, the runtime
1656  * might not terminate a blocking thread in a timely manner.
1657  *
1658  * If the underlying platform support is available, it's used to wake up
1659  * the thread for async termination. The expectation here is that a
1660  * `os_wakeup_blocking_op` call makes the blocking operation
1661  * (`possibly_blocking_op` in the above example) return in a timely manner.
1662  *
1663  * The actual wake up mechanism used by `os_wakeup_blocking_op` is
1664  * platform-dependent. It might impose some platform-dependent restrictions
1665  * on the implementation of the blocking opearation.
1666  *
1667  * For example, on POSIX-like platforms, a signal (by default SIGUSR1) is
1668  * used. The signal delivery configurations (eg. signal handler, signal mask,
1669  * etc) for the signal are set up by the runtime. You can change the signal
1670  * to use for this purpose by calling os_set_signal_number_for_blocking_op
1671  * before the runtime initialization.
1672  */
1673 WASM_RUNTIME_API_EXTERN bool
1674 wasm_runtime_begin_blocking_op(wasm_exec_env_t exec_env);
1675 
1676 WASM_RUNTIME_API_EXTERN void
1677 wasm_runtime_end_blocking_op(wasm_exec_env_t exec_env);
1678 
1679 
1680 WASM_RUNTIME_API_EXTERN bool
1681 wasm_runtime_set_module_name(wasm_module_t module, const char *name,
1682  char *error_buf, uint32_t error_buf_size);
1683 
1684 /* return the most recently set module name or "" if never set before */
1685 WASM_RUNTIME_API_EXTERN const char*
1686 wasm_runtime_get_module_name(wasm_module_t module);
1687 
1688 /* clang-format on */
1689 
1690 #ifdef __cplusplus
1691 }
1692 #endif
1693 
1694 #endif /* end of _WASM_EXPORT_H */
wasm_runtime_destroy
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy(void)
wasm_runtime_dump_mem_consumption
WASM_RUNTIME_API_EXTERN void wasm_runtime_dump_mem_consumption(wasm_exec_env_t exec_env)
module_reader
bool(* module_reader)(package_type_t module_type, const char *module_name, uint8_t **p_buffer, uint32_t *p_size)
Definition: wasm_export.h:360
wasm_runtime_get_module
WASM_RUNTIME_API_EXTERN wasm_module_t wasm_runtime_get_module(wasm_module_inst_t module_inst)
wasm_runtime_is_bounds_checks_enabled
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_bounds_checks_enabled(wasm_module_inst_t module_inst)
wasm_runtime_register_natives_raw
WASM_RUNTIME_API_EXTERN bool wasm_runtime_register_natives_raw(const char *module_name, NativeSymbol *native_symbols, uint32_t n_native_symbols)
wasm_runtime_get_module_hash
char * wasm_runtime_get_module_hash(wasm_module_t module)
wasm_runtime_set_wasi_args_ex
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_wasi_args_ex(wasm_module_t module, const char *dir_list[], uint32_t dir_count, const char *map_dir_list[], uint32_t map_dir_count, const char *env[], uint32_t env_count, char *argv[], int argc, int64_t stdinfd, int64_t stdoutfd, int64_t stderrfd)
wasm_runtime_call_indirect
WASM_RUNTIME_API_EXTERN bool wasm_runtime_call_indirect(wasm_exec_env_t exec_env, uint32_t element_index, uint32_t argc, uint32_t argv[])
wasm_externref_set_cleanup
WASM_RUNTIME_API_EXTERN bool wasm_externref_set_cleanup(wasm_module_inst_t module_inst, void *extern_obj, void(*extern_obj_cleanup)(void *))
module_destroyer
void(* module_destroyer)(uint8_t *buffer, uint32_t size)
Definition: wasm_export.h:367
wasm_runtime_start_debug_instance_with_port
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_start_debug_instance_with_port(wasm_exec_env_t exec_env, int32_t port)
wasm_runtime_module_malloc
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_module_malloc(wasm_module_inst_t module_inst, uint64_t size, void **p_native_addr)
wasm_runtime_call_wasm_v
WASM_RUNTIME_API_EXTERN bool wasm_runtime_call_wasm_v(wasm_exec_env_t exec_env, wasm_function_inst_t function, uint32_t num_results, wasm_val_t results[], uint32_t num_args,...)
wasm_runtime_start_debug_instance
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_start_debug_instance(wasm_exec_env_t exec_env)
wasm_runtime_terminate
WASM_RUNTIME_API_EXTERN void wasm_runtime_terminate(wasm_module_inst_t module_inst)
wasm_runtime_register_natives
WASM_RUNTIME_API_EXTERN bool wasm_runtime_register_natives(const char *module_name, NativeSymbol *native_symbols, uint32_t n_native_symbols)
MemAllocOption
Definition: wasm_c_api.h:171
wasm_runtime_set_bounds_checks
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_bounds_checks(wasm_module_inst_t module_inst, bool enable)
wasm_runtime_get_function_attachment
WASM_RUNTIME_API_EXTERN void * wasm_runtime_get_function_attachment(wasm_exec_env_t exec_env)
wasm_runtime_call_wasm_a
WASM_RUNTIME_API_EXTERN bool wasm_runtime_call_wasm_a(wasm_exec_env_t exec_env, wasm_function_inst_t function, uint32_t num_results, wasm_val_t results[], uint32_t num_args, wasm_val_t *args)
wasm_runtime_unload
WASM_RUNTIME_API_EXTERN void wasm_runtime_unload(wasm_module_t module)
lib_export.h
mem_alloc_info_t
Definition: wasm_export.h:135
wasm_runtime_addr_native_to_app
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst, void *native_ptr)
wasm_runtime_set_default_running_mode
WASM_RUNTIME_API_EXTERN bool wasm_runtime_set_default_running_mode(RunningMode running_mode)
wasm_runtime_load_from_sections
WASM_RUNTIME_API_EXTERN wasm_module_t wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot, char *error_buf, uint32_t error_buf_size)
wasm_runtime_dump_perf_profiling
WASM_RUNTIME_API_EXTERN void wasm_runtime_dump_perf_profiling(wasm_module_inst_t module_inst)
wasm_runtime_get_exec_env_singleton
WASM_RUNTIME_API_EXTERN wasm_exec_env_t wasm_runtime_get_exec_env_singleton(wasm_module_inst_t module_inst)
wasm_runtime_module_free
WASM_RUNTIME_API_EXTERN void wasm_runtime_module_free(wasm_module_inst_t module_inst, uint64_t ptr)
wasm_runtime_get_version
WASM_RUNTIME_API_EXTERN void wasm_runtime_get_version(uint32_t *major, uint32_t *minor, uint32_t *patch)
wasm_runtime_clear_exception
WASM_RUNTIME_API_EXTERN void wasm_runtime_clear_exception(wasm_module_inst_t module_inst)
wasm_runtime_get_custom_section
const WASM_RUNTIME_API_EXTERN uint8_t * wasm_runtime_get_custom_section(wasm_module_t const module_comm, const char *name, uint32_t *len)
wasm_runtime_lookup_function
WASM_RUNTIME_API_EXTERN wasm_function_inst_t wasm_runtime_lookup_function(wasm_module_inst_t const module_inst, const char *name)
wasm_func_get_param_count
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_param_count(wasm_function_inst_t const func_inst, wasm_module_inst_t const module_inst)
wasm_runtime_destroy_spawned_exec_env
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_spawned_exec_env(wasm_exec_env_t exec_env)
wasm_runtime_find_module_registered
WASM_RUNTIME_API_EXTERN wasm_module_t wasm_runtime_find_module_registered(const char *module_name)
wasm_runtime_set_custom_data
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_custom_data(wasm_module_inst_t module_inst, void *custom_data)
wasm_runtime_module_dup_data
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_module_dup_data(wasm_module_inst_t module_inst, const char *src, uint64_t size)
wasm_externref_ref2obj
WASM_RUNTIME_API_EXTERN bool wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj)
wasm_runtime_get_running_mode
WASM_RUNTIME_API_EXTERN RunningMode wasm_runtime_get_running_mode(wasm_module_inst_t module_inst)
wasm_runtime_get_app_addr_range
WASM_RUNTIME_API_EXTERN bool wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst, uint64_t app_offset, uint64_t *p_app_start_offset, uint64_t *p_app_end_offset)
wasm_runtime_init
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init(void)
wasm_runtime_init_thread_env
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init_thread_env(void)
get_package_type
WASM_RUNTIME_API_EXTERN package_type_t get_package_type(const uint8_t *buf, uint32_t size)
wasm_runtime_is_xip_file
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_xip_file(const uint8_t *buf, uint32_t size)
wasm_externref_obj2ref
WASM_RUNTIME_API_EXTERN bool wasm_externref_obj2ref(wasm_module_inst_t module_inst, void *extern_obj, uint32_t *p_externref_idx)
wasm_runtime_full_init
WASM_RUNTIME_API_EXTERN bool wasm_runtime_full_init(RuntimeInitArgs *init_args)
wasm_runtime_get_custom_data
WASM_RUNTIME_API_EXTERN void * wasm_runtime_get_custom_data(wasm_module_inst_t module_inst)
wasm_runtime_malloc
WASM_RUNTIME_API_EXTERN void * wasm_runtime_malloc(unsigned int size)
wasm_runtime_destroy_exec_env
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env)
wasm_runtime_deinstantiate
WASM_RUNTIME_API_EXTERN void wasm_runtime_deinstantiate(wasm_module_inst_t module_inst)
wasm_runtime_set_exception
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_exception(wasm_module_inst_t module_inst, const char *exception)
wasm_runtime_dump_call_stack_to_buf
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_dump_call_stack_to_buf(wasm_exec_env_t exec_env, char *buf, uint32_t len)
wasm_val_t
Definition: wasm_c_api.h:435
wasm_runtime_get_wasi_exit_code
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst)
wasm_runtime_destroy_thread_env
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_thread_env(void)
wasm_runtime_set_module_reader
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_module_reader(const module_reader reader, const module_destroyer destroyer)
wasm_runtime_validate_native_addr
WASM_RUNTIME_API_EXTERN bool wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst, void *native_ptr, uint64_t size)
wasm_runtime_is_import_func_linked
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_import_func_linked(const char *module_name, const char *func_name)
RuntimeInitArgs
Definition: wasm_export.h:150
wasm_runtime_instantiate_ex
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate_ex(const wasm_module_t module, const InstantiationArgs *args, char *error_buf, uint32_t error_buf_size)
wasm_func_get_result_count
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_result_count(wasm_function_inst_t const func_inst, wasm_module_inst_t const module_inst)
wasm_runtime_unregister_natives
WASM_RUNTIME_API_EXTERN bool wasm_runtime_unregister_natives(const char *module_name, NativeSymbol *native_symbols)
wasm_runtime_set_running_mode
WASM_RUNTIME_API_EXTERN bool wasm_runtime_set_running_mode(wasm_module_inst_t module_inst, RunningMode running_mode)
wasm_runtime_register_module
WASM_RUNTIME_API_EXTERN bool wasm_runtime_register_module(const char *module_name, wasm_module_t module, char *error_buf, uint32_t error_buf_size)
wasm_runtime_realloc
WASM_RUNTIME_API_EXTERN void * wasm_runtime_realloc(void *ptr, unsigned int size)
wasm_runtime_thread_env_inited
WASM_RUNTIME_API_EXTERN bool wasm_runtime_thread_env_inited(void)
wasm_runtime_spawn_exec_env
WASM_RUNTIME_API_EXTERN wasm_exec_env_t wasm_runtime_spawn_exec_env(wasm_exec_env_t exec_env)
InstantiationArgs
Definition: wasm_c_api.h:199
wasm_runtime_get_user_data
WASM_RUNTIME_API_EXTERN void * wasm_runtime_get_user_data(wasm_exec_env_t exec_env)
NativeSymbol
Definition: lib_export.h:21
wasm_runtime_get_pgo_prof_data_size
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_get_pgo_prof_data_size(wasm_module_inst_t module_inst)
wasm_runtime_dump_call_stack
WASM_RUNTIME_API_EXTERN void wasm_runtime_dump_call_stack(wasm_exec_env_t exec_env)
RuntimeInitArgs::enable_linux_perf
bool enable_linux_perf
Definition: wasm_export.h:190
wasm_runtime_get_module_inst
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_get_module_inst(wasm_exec_env_t exec_env)
wasm_externref_retain
WASM_RUNTIME_API_EXTERN bool wasm_externref_retain(uint32_t externref_idx)
wasm_runtime_set_enlarge_mem_error_callback
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_enlarge_mem_error_callback(const enlarge_memory_error_callback_t callback, void *user_data)
wasm_runtime_set_user_data
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_user_data(wasm_exec_env_t exec_env, void *user_data)
wasm_runtime_get_exception
const WASM_RUNTIME_API_EXTERN char * wasm_runtime_get_exception(wasm_module_inst_t module_inst)
wasm_runtime_set_module_inst
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_module_inst(wasm_exec_env_t exec_env, const wasm_module_inst_t module_inst)
wasm_runtime_is_running_mode_supported
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_running_mode_supported(RunningMode running_mode)
wasm_runtime_dump_pgo_prof_data_to_buf
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_dump_pgo_prof_data_to_buf(wasm_module_inst_t module_inst, char *buf, uint32_t len)
wasm_runtime_instantiate
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate(const wasm_module_t module, uint32_t default_stack_size, uint32_t host_managed_heap_size, char *error_buf, uint32_t error_buf_size)
wasm_runtime_validate_app_str_addr
WASM_RUNTIME_API_EXTERN bool wasm_runtime_validate_app_str_addr(wasm_module_inst_t module_inst, uint64_t app_str_offset)
wasm_func_get_param_types
WASM_RUNTIME_API_EXTERN void wasm_func_get_param_types(wasm_function_inst_t const func_inst, wasm_module_inst_t const module_inst, wasm_valkind_t *param_types)
wasm_runtime_set_log_level
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_log_level(log_level_t level)
wasm_func_get_result_types
WASM_RUNTIME_API_EXTERN void wasm_func_get_result_types(wasm_function_inst_t const func_inst, wasm_module_inst_t const module_inst, wasm_valkind_t *result_types)
wasm_runtime_spawn_thread
WASM_RUNTIME_API_EXTERN int32_t wasm_runtime_spawn_thread(wasm_exec_env_t exec_env, wasm_thread_t *tid, wasm_thread_callback_t callback, void *arg)
wasm_runtime_get_wasm_func_exec_time
WASM_RUNTIME_API_EXTERN double wasm_runtime_get_wasm_func_exec_time(wasm_module_inst_t inst, const char *func_name)
wasm_application_execute_func
WASM_RUNTIME_API_EXTERN bool wasm_application_execute_func(wasm_module_inst_t module_inst, const char *name, int32_t argc, char *argv[])
wasm_runtime_get_call_stack_buf_size
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env)
wasm_runtime_create_exec_env
WASM_RUNTIME_API_EXTERN wasm_exec_env_t wasm_runtime_create_exec_env(wasm_module_inst_t module_inst, uint32_t stack_size)
wasm_externref_objdel
WASM_RUNTIME_API_EXTERN bool wasm_externref_objdel(wasm_module_inst_t module_inst, void *extern_obj)
wasm_runtime_validate_app_addr
WASM_RUNTIME_API_EXTERN bool wasm_runtime_validate_app_addr(wasm_module_inst_t module_inst, uint64_t app_offset, uint64_t size)
wasm_application_execute_main
WASM_RUNTIME_API_EXTERN bool wasm_application_execute_main(wasm_module_inst_t module_inst, int32_t argc, char *argv[])
wasm_runtime_addr_app_to_native
WASM_RUNTIME_API_EXTERN void * wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst, uint64_t app_offset)
wasm_runtime_join_thread
WASM_RUNTIME_API_EXTERN int32_t wasm_runtime_join_thread(wasm_thread_t tid, void **retval)
wasm_runtime_set_wasi_args
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_wasi_args(wasm_module_t module, const char *dir_list[], uint32_t dir_count, const char *map_dir_list[], uint32_t map_dir_count, const char *env[], uint32_t env_count, char *argv[], int argc)
wasm_section_t
Definition: wasm_export.h:82
wasm_runtime_get_native_addr_range
WASM_RUNTIME_API_EXTERN bool wasm_runtime_get_native_addr_range(wasm_module_inst_t module_inst, uint8_t *native_ptr, uint8_t **p_native_start_addr, uint8_t **p_native_end_addr)
wasm_runtime_call_wasm
WASM_RUNTIME_API_EXTERN bool wasm_runtime_call_wasm(wasm_exec_env_t exec_env, wasm_function_inst_t function, uint32_t argc, uint32_t argv[])
wasm_runtime_sum_wasm_exec_time
WASM_RUNTIME_API_EXTERN double wasm_runtime_sum_wasm_exec_time(wasm_module_inst_t module_inst)
wasm_runtime_is_import_global_linked
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_import_global_linked(const char *module_name, const char *global_name)
wasm_runtime_load
WASM_RUNTIME_API_EXTERN wasm_module_t wasm_runtime_load(uint8_t *buf, uint32_t size, char *error_buf, uint32_t error_buf_size)
wasm_runtime_set_max_thread_num
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_max_thread_num(uint32_t num)