Compare commits

...
3 Commits
5 changed files with 338 additions and 329 deletions
+8 -3
View File
@@ -202,7 +202,6 @@ local $ENV{WAMR_USE_LINEAR_POOL_IN_TEXT} =
# ========================================================================================= #
# NOTE: The runner will prefix "-Wf," to each flag
# TODO: Exclude --wamr-exceptions from C builds automatically
my %catch_flag_map = (
"--catch-outer" => "--catch-outerspace",
"--catch-text" => "--catch-write-textsegment",
@@ -224,6 +223,12 @@ foreach my $experiment (@selected_experiments) {
foreach my $target (@selected_targets) {
foreach my $mode (@selected_modes) {
# Remove --wamr-exceptions for C builds, it is WAMR-specific
my @build_catch_flags =
$mode eq "c"
? grep { $_ ne "--wamr-exceptions" } @selected_catch_flags
: @selected_catch_flags;
my $allocator_info = "";
if ( $mode eq "aot" || $mode eq "interp" ) {
$allocator_info =
@@ -267,7 +272,7 @@ foreach my $experiment (@selected_experiments) {
&& $selected_linear_pool_variant eq $linear_pool_variants[0] )
? "wamr_linear_pool"
: "";
my $flags_info = join " ", @selected_catch_flags;
my $flags_info = join " ", @build_catch_flags;
my $info_str = join " ",
grep { length } (
@@ -288,7 +293,7 @@ foreach my $experiment (@selected_experiments) {
"$local_root/build-$experiment/runner_flags";
open( my $fhandle, '>', $runner_flags_path )
or die "Cannot write $runner_flags_path: $!";
print $fhandle "$catch_flag_map{$_}\n" for @selected_catch_flags;
print $fhandle "$catch_flag_map{$_}\n" for @build_catch_flags;
close($fhandle);
system( "mv", "$local_root/build.log",
+1
View File
@@ -40,6 +40,7 @@
#ifdef TARGET_LINUX
#include "stdio.h"
#include <string.h>
#define MAIN int main(int argc, char *argv[])
#define PRINT(fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__)
#define PRINT_ERROR(fmt, ...) \
+59
View File
@@ -0,0 +1,59 @@
/*
* Copyright (C) 2019 Intel Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
/**
* @file lib_export.h
*
*/
#ifndef _LIB_EXPORT_H_
#define _LIB_EXPORT_H_
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct NativeSymbol {
const char *symbol;
void *func_ptr;
const char *signature;
/* attachment which can be retrieved in native API by
calling wasm_runtime_get_function_attachment(exec_env) */
void *attachment;
} NativeSymbol;
/* clang-format off */
#define EXPORT_WASM_API(symbol) \
{ #symbol, (void *)symbol, NULL, NULL }
#define EXPORT_WASM_API2(symbol) \
{ #symbol, (void *)symbol##_wrapper, NULL, NULL }
#define EXPORT_WASM_API_WITH_SIG(symbol, signature) \
{ #symbol, (void *)symbol, signature, NULL }
#define EXPORT_WASM_API_WITH_SIG2(symbol, signature) \
{ #symbol, (void *)symbol##_wrapper, signature, NULL }
#define EXPORT_WASM_API_WITH_ATT(symbol, signature, attachment) \
{ #symbol, (void *)symbol, signature, attachment }
#define EXPORT_WASM_API_WITH_ATT2(symbol, signature, attachment) \
{ #symbol, (void *)symbol##_wrapper, signature, attachment }
/* clang-format on */
/**
* Get the exported APIs of base lib
*
* @param p_base_lib_apis return the exported API array of base lib
*
* @return the number of the exported API
*/
uint32_t get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
#ifdef __cplusplus
}
#endif
#endif /* end of _LIB_EXPORT_H_ */
+1 -7
View File
@@ -3,10 +3,6 @@
#include "bh_platform.h"
#include "__WASM_ARRAY_FILE__"
#ifdef TARGET_LINUX
#include <stdio.h>
#include <string.h>
#endif
// FAIL* instrumentation symbols
void fail_start_trace(void) {}
@@ -64,9 +60,7 @@ static BumpPool pools[] = {
{linear_pool_buf, LINEAR_POOL_SIZE, 0},
};
static size_t align_up(size_t x, size_t a) {
return (x + a - 1) & ~(a - 1);
}
static size_t align_up(size_t x, size_t a) { return (x + a - 1) & ~(a - 1); }
static size_t alloc_size(void *ptr) {
size_t header_size = align_up(sizeof(size_t), ALIGNMENT);
+95 -145
View File
@@ -12,9 +12,9 @@
#ifndef _WASM_EXPORT_H
#define _WASM_EXPORT_H
#include <stdint.h>
#include <stdbool.h>
#include "lib_export.h"
#include <stdbool.h>
#include <stdint.h>
#ifndef WASM_RUNTIME_API_EXTERN
#if defined(_MSC_BUILD)
@@ -361,8 +361,7 @@ typedef struct SharedHeapInitArgs {
*
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_init(void);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init(void);
/**
* Initialize the WASM runtime environment, WASM running mode,
@@ -373,16 +372,14 @@ wasm_runtime_init(void);
*
* @return return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_full_init(RuntimeInitArgs *init_args);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_full_init(RuntimeInitArgs *init_args);
/**
* Set the log level. To be called after the runtime is initialized.
*
* @param level the log level to set
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_set_log_level(log_level_t level);
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_log_level(log_level_t level);
/**
* Query whether a certain running mode is supported for the runtime
@@ -409,8 +406,7 @@ wasm_runtime_set_default_running_mode(RunningMode running_mode);
/**
* Destroy the WASM runtime environment.
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_destroy(void);
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy(void);
/**
* Allocate memory from runtime memory environment.
@@ -419,8 +415,7 @@ wasm_runtime_destroy(void);
*
* @return the pointer to memory allocated
*/
WASM_RUNTIME_API_EXTERN void *
wasm_runtime_malloc(unsigned int size);
WASM_RUNTIME_API_EXTERN void *wasm_runtime_malloc(unsigned int size);
/**
* Reallocate memory from runtime memory environment
@@ -430,14 +425,13 @@ wasm_runtime_malloc(unsigned int size);
*
* @return the pointer to memory reallocated
*/
WASM_RUNTIME_API_EXTERN void *
wasm_runtime_realloc(void *ptr, unsigned int size);
WASM_RUNTIME_API_EXTERN void *wasm_runtime_realloc(void *ptr,
unsigned int size);
/*
* Free memory to runtime memory environment.
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_free(void *ptr);
WASM_RUNTIME_API_EXTERN void wasm_runtime_free(void *ptr);
/*
* Get memory info, only pool mode is supported now.
@@ -453,8 +447,8 @@ wasm_runtime_get_mem_alloc_info(mem_alloc_info_t *mem_alloc_info);
*
* @return the package type, return Package_Type_Unknown if the type is unknown
*/
WASM_RUNTIME_API_EXTERN package_type_t
get_package_type(const uint8_t *buf, uint32_t size);
WASM_RUNTIME_API_EXTERN package_type_t get_package_type(const uint8_t *buf,
uint32_t size);
/**
* Get the package type of a buffer (same as get_package_type).
@@ -517,8 +511,8 @@ wasm_runtime_get_current_package_version(package_type_t package_type);
*
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_is_xip_file(const uint8_t *buf, uint32_t size);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_is_xip_file(const uint8_t *buf,
uint32_t size);
/**
* Callback to load a module file into a buffer in multi-module feature
@@ -588,9 +582,8 @@ wasm_runtime_find_module_registered(const char *module_name);
*
* @return return WASM module loaded, NULL if failed
*/
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_API_EXTERN wasm_module_t wasm_runtime_load(
uint8_t *buf, uint32_t size, char *error_buf, uint32_t error_buf_size);
/**
* Load a WASM module with specified load argument.
@@ -603,8 +596,7 @@ wasm_runtime_load_ex(uint8_t *buf, uint32_t size, const LoadArgs *args,
* Resolve symbols for a previously loaded WASM module. Only useful when the
* module was loaded with LoadArgs::no_resolve set to true
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_resolve_symbols(wasm_module_t module);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_resolve_symbols(wasm_module_t module);
/**
* Load a WASM module from a specified WASM or AOT section list.
*
@@ -624,8 +616,7 @@ wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot,
*
* @param module the module to be unloaded
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_unload(wasm_module_t module);
WASM_RUNTIME_API_EXTERN void wasm_runtime_unload(wasm_module_t module);
/**
* Get the module hash of a WASM module, currently only available on
@@ -635,8 +626,7 @@ wasm_runtime_unload(wasm_module_t module);
*
* @return the module hash of the WASM module
*/
char *
wasm_runtime_get_module_hash(wasm_module_t module);
char *wasm_runtime_get_module_hash(wasm_module_t module);
/**
* Set WASI parameters.
@@ -671,13 +661,11 @@ wasm_runtime_get_module_hash(wasm_module_t module);
* INVALID_HANDLE_VALUE on Windows), the platform default
* for STDERR is used.
*/
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_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);
/**
* Set WASI parameters.
@@ -718,11 +706,9 @@ wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module,
*
* @return return the instantiated WASM module instance, NULL if failed
*/
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_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);
/**
* Instantiate a WASM module, with specified instantiation arguments
@@ -730,9 +716,8 @@ wasm_runtime_instantiate(const wasm_module_t module,
* Same as wasm_runtime_instantiate, but it also allows overwriting maximum
* memory
*/
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
wasm_runtime_instantiate_ex(const wasm_module_t module,
const InstantiationArgs *args, char *error_buf,
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);
/**
@@ -768,22 +753,15 @@ WASM_RUNTIME_API_EXTERN void
wasm_runtime_instantiation_args_set_wasi_arg(struct InstantiationArgs2 *p,
char *argv[], int argc);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_instantiation_args_set_wasi_env(struct InstantiationArgs2 *p,
const char *env[],
uint32_t env_count);
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_env(
struct InstantiationArgs2 *p, const char *env[], uint32_t env_count);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_instantiation_args_set_wasi_dir(struct InstantiationArgs2 *p,
const char *dir_list[],
uint32_t dir_count,
const char *map_dir_list[],
uint32_t map_dir_count);
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_dir(
struct InstantiationArgs2 *p, const char *dir_list[], uint32_t dir_count,
const char *map_dir_list[], uint32_t map_dir_count);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_instantiation_args_set_wasi_stdio(struct InstantiationArgs2 *p,
int64_t stdinfd,
int64_t stdoutfd,
WASM_RUNTIME_API_EXTERN void wasm_runtime_instantiation_args_set_wasi_stdio(
struct InstantiationArgs2 *p, int64_t stdinfd, int64_t stdoutfd,
int64_t stderrfd);
WASM_RUNTIME_API_EXTERN void
@@ -802,9 +780,8 @@ wasm_runtime_instantiation_args_set_wasi_ns_lookup_pool(
* Same as wasm_runtime_instantiate_ex, but this version takes
* InstantiationArgs2, which can be extended without breaking the ABI.
*/
WASM_RUNTIME_API_EXTERN wasm_module_inst_t
wasm_runtime_instantiate_ex2(const wasm_module_t module,
const struct InstantiationArgs2 *args,
WASM_RUNTIME_API_EXTERN wasm_module_inst_t wasm_runtime_instantiate_ex2(
const wasm_module_t module, const struct InstantiationArgs2 *args,
char *error_buf, uint32_t error_buf_size);
/**
@@ -879,9 +856,8 @@ wasm_runtime_get_wasi_exit_code(wasm_module_inst_t module_inst);
*
* @return the function instance found, NULL if not found
*/
WASM_RUNTIME_API_EXTERN wasm_function_inst_t
wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
const char *name);
WASM_RUNTIME_API_EXTERN wasm_function_inst_t wasm_runtime_lookup_function(
const wasm_module_inst_t module_inst, const char *name);
/**
* Get parameter count of the function instance
@@ -891,9 +867,8 @@ wasm_runtime_lookup_function(const wasm_module_inst_t module_inst,
*
* @return the parameter count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_param_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_param_count(
const wasm_function_inst_t func_inst, const wasm_module_inst_t module_inst);
/**
* Get result count of the function instance
@@ -903,9 +878,8 @@ wasm_func_get_param_count(const wasm_function_inst_t func_inst,
*
* @return the result count of the function instance
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_func_get_result_count(const wasm_function_inst_t func_inst,
const wasm_module_inst_t module_inst);
WASM_RUNTIME_API_EXTERN uint32_t wasm_func_get_result_count(
const wasm_function_inst_t func_inst, const wasm_module_inst_t module_inst);
/**
* Get parameter types of the function instance
@@ -940,9 +914,8 @@ wasm_func_get_result_types(const wasm_function_inst_t func_inst,
* @return the execution environment, NULL if failed, e.g. invalid
* stack size is passed
*/
WASM_RUNTIME_API_EXTERN wasm_exec_env_t
wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
uint32_t stack_size);
WASM_RUNTIME_API_EXTERN wasm_exec_env_t wasm_runtime_create_exec_env(
wasm_module_inst_t module_inst, uint32_t stack_size);
/**
* Destroy the execution environment.
@@ -1018,9 +991,8 @@ wasm_runtime_get_exec_env_singleton(wasm_module_inst_t module_inst);
*
* @return debug port if success, 0 otherwise.
*/
WASM_RUNTIME_API_EXTERN uint32_t
wasm_runtime_start_debug_instance_with_port(wasm_exec_env_t exec_env,
int32_t port);
WASM_RUNTIME_API_EXTERN uint32_t wasm_runtime_start_debug_instance_with_port(
wasm_exec_env_t exec_env, int32_t port);
/**
* Same as wasm_runtime_start_debug_instance_with_port(env, -1).
@@ -1040,20 +1012,17 @@ wasm_runtime_start_debug_instance(wasm_exec_env_t exec_env);
*
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_init_thread_env(void);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_init_thread_env(void);
/**
* Destroy the thread environment
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_destroy_thread_env(void);
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_thread_env(void);
/**
* Whether the thread environment is initialized
*/
WASM_RUNTIME_API_EXTERN bool
wasm_runtime_thread_env_inited(void);
WASM_RUNTIME_API_EXTERN bool wasm_runtime_thread_env_inited(void);
/**
* Get WASM module instance from execution environment
@@ -1088,9 +1057,8 @@ wasm_runtime_set_module_inst(wasm_exec_env_t exec_env,
*
* @return The memory instance if found, NULL otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t
wasm_runtime_lookup_memory(const wasm_module_inst_t module_inst,
const char *name);
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t wasm_runtime_lookup_memory(
const wasm_module_inst_t module_inst, const char *name);
/**
* @brief Get the default memory instance
@@ -1171,8 +1139,8 @@ wasm_memory_get_base_address(const wasm_memory_inst_t memory_inst);
*
* @return True if successful, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_memory_enlarge(wasm_memory_inst_t memory_inst, uint64_t inc_page_count);
WASM_RUNTIME_API_EXTERN bool wasm_memory_enlarge(wasm_memory_inst_t memory_inst,
uint64_t inc_page_count);
/**
* Call the given WASM function of a WASM module instance with
@@ -1409,9 +1377,8 @@ wasm_runtime_is_bounds_checks_enabled(wasm_module_inst_t module_inst);
* it is not an absolute address.
* Return non-zero if success, zero if failed.
*/
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_API_EXTERN uint64_t wasm_runtime_module_malloc(
wasm_module_inst_t module_inst, uint64_t size, void **p_native_addr);
/**
* Free memory to the heap of WASM module instance
@@ -1435,9 +1402,8 @@ wasm_runtime_module_free(wasm_module_inst_t module_inst, uint64_t ptr);
* it is not an absolute address.
* Return non-zero if success, zero if failed.
*/
WASM_RUNTIME_API_EXTERN uint64_t
wasm_runtime_module_dup_data(wasm_module_inst_t module_inst, const char *src,
uint64_t size);
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_module_dup_data(
wasm_module_inst_t module_inst, const char *src, uint64_t size);
/**
* Validate the app address, check whether it belongs to WASM module
@@ -1516,9 +1482,8 @@ wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
*
* @return the app address converted
*/
WASM_RUNTIME_API_EXTERN uint64_t
wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
void *native_ptr);
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_addr_native_to_app(
wasm_module_inst_t module_inst, void *native_ptr);
/**
* Get the app address range (relative address) that a app address belongs to
@@ -1530,11 +1495,9 @@ wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
*
* @return true if success, false otherwise.
*/
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_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);
/**
* Get the native address range (absolute address) that a native address
@@ -1549,11 +1512,9 @@ wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst,
*
* @return true if success, false otherwise.
*/
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_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);
/**
* Get the number of import items for a WASM module
@@ -1631,9 +1592,8 @@ wasm_func_type_get_param_count(const wasm_func_type_t func_type);
*
* @return the kind of the parameter if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_param_valkind(const wasm_func_type_t func_type,
uint32_t param_index);
WASM_RUNTIME_API_EXTERN wasm_valkind_t wasm_func_type_get_param_valkind(
const wasm_func_type_t func_type, uint32_t param_index);
/**
* Get the number of results for a function type
@@ -1653,9 +1613,8 @@ wasm_func_type_get_result_count(const wasm_func_type_t func_type);
*
* @return the kind of the result if successful, -1 otherwise
*/
WASM_RUNTIME_API_EXTERN wasm_valkind_t
wasm_func_type_get_result_valkind(const wasm_func_type_t func_type,
uint32_t result_index);
WASM_RUNTIME_API_EXTERN wasm_valkind_t wasm_func_type_get_result_valkind(
const wasm_func_type_t func_type, uint32_t result_index);
/**
* Get the kind for a global type
@@ -1978,8 +1937,7 @@ typedef uintptr_t wasm_thread_t;
*
* @param num maximum thread num
*/
WASM_RUNTIME_API_EXTERN void
wasm_runtime_set_max_thread_num(uint32_t num);
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_max_thread_num(uint32_t num);
/**
* Spawn a new exec_env, the spawned exec_env
@@ -2022,8 +1980,8 @@ wasm_runtime_spawn_thread(wasm_exec_env_t exec_env, wasm_thread_t *tid,
*
* @return 0 if success, error number otherwise
*/
WASM_RUNTIME_API_EXTERN int32_t
wasm_runtime_join_thread(wasm_thread_t tid, void **retval);
WASM_RUNTIME_API_EXTERN int32_t wasm_runtime_join_thread(wasm_thread_t tid,
void **retval);
/**
* Map external object to an internal externref index: if the index
@@ -2076,8 +2034,8 @@ wasm_externref_set_cleanup(wasm_module_inst_t module_inst, void *extern_obj,
*
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj);
WASM_RUNTIME_API_EXTERN bool wasm_externref_ref2obj(uint32_t externref_idx,
void **p_extern_obj);
/**
* Retain an extern object which is mapped to the internal externref
@@ -2088,8 +2046,7 @@ wasm_externref_ref2obj(uint32_t externref_idx, void **p_extern_obj);
* to retain
* @return true if success, false otherwise
*/
WASM_RUNTIME_API_EXTERN bool
wasm_externref_retain(uint32_t externref_idx);
WASM_RUNTIME_API_EXTERN bool wasm_externref_retain(uint32_t externref_idx);
/**
* Dump the call stack to stdout
@@ -2123,9 +2080,8 @@ wasm_runtime_get_call_stack_buf_size(wasm_exec_env_t exec_env);
* @return bytes dumped to the buffer, including the terminating null
* byte ('\0'), 0 means error and data in buf may be invalid
*/
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_RUNTIME_API_EXTERN uint32_t wasm_runtime_dump_call_stack_to_buf(
wasm_exec_env_t exec_env, char *buf, uint32_t len);
/**
* Get the size required to store the LLVM PGO profile data
@@ -2147,9 +2103,8 @@ wasm_runtime_get_pgo_prof_data_size(wasm_module_inst_t module_inst);
* @return bytes dumped to the buffer, 0 means error and data in buf
* may be invalid
*/
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_API_EXTERN uint32_t wasm_runtime_dump_pgo_prof_data_to_buf(
wasm_module_inst_t module_inst, char *buf, uint32_t len);
/**
* Get a custom section by name
@@ -2212,8 +2167,7 @@ typedef void (*enlarge_memory_error_callback_t)(
/**
* Setup callback invoked when memory.grow fails
*/
WASM_RUNTIME_API_EXTERN void
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);
/*
@@ -2268,21 +2222,19 @@ wasm_runtime_set_enlarge_mem_error_callback(
* - The destructor is called only on the main instance.
*/
WASM_RUNTIME_API_EXTERN void *
wasm_runtime_create_context_key(void (*dtor)(wasm_module_inst_t inst,
void *ctx));
WASM_RUNTIME_API_EXTERN void *wasm_runtime_create_context_key(
void (*dtor)(wasm_module_inst_t inst, void *ctx));
WASM_RUNTIME_API_EXTERN void
wasm_runtime_destroy_context_key(void *key);
WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_context_key(void *key);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_set_context(wasm_module_inst_t inst, void *key, void *ctx);
WASM_RUNTIME_API_EXTERN void wasm_runtime_set_context(wasm_module_inst_t inst,
void *key, void *ctx);
WASM_RUNTIME_API_EXTERN void
wasm_runtime_set_context_spread(wasm_module_inst_t inst, void *key, void *ctx);
WASM_RUNTIME_API_EXTERN void *
wasm_runtime_get_context(wasm_module_inst_t inst, void *key);
WASM_RUNTIME_API_EXTERN void *wasm_runtime_get_context(wasm_module_inst_t inst,
void *key);
/*
* wasm_runtime_begin_blocking_op/wasm_runtime_end_blocking_op
@@ -2419,9 +2371,8 @@ wasm_runtime_create_shared_heap(SharedHeapInitArgs *init_args);
* @param body The body of the shared heap chain to be appended.
* @return The new head of the shared heap chain. NULL if failed.
*/
WASM_RUNTIME_API_EXTERN wasm_shared_heap_t
wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head,
wasm_shared_heap_t body);
WASM_RUNTIME_API_EXTERN wasm_shared_heap_t wasm_runtime_chain_shared_heaps(
wasm_shared_heap_t head, wasm_shared_heap_t body);
/**
* This function unchains the shared heaps from the given head. If
@@ -2434,8 +2385,8 @@ wasm_runtime_chain_shared_heaps(wasm_shared_heap_t head,
* @return The new head of the shared heap chain. Or the last shared heap in the
* chain if `entire_chain` is true.
*/
wasm_shared_heap_t
wasm_runtime_unchain_shared_heaps(wasm_shared_heap_t head, bool entire_chain);
wasm_shared_heap_t wasm_runtime_unchain_shared_heaps(wasm_shared_heap_t head,
bool entire_chain);
/**
* Reset shared heap chain. For each shared heap in the chain, if it is a
@@ -2482,9 +2433,8 @@ wasm_runtime_detach_shared_heap(wasm_module_inst_t module_inst);
* (when the wasm memory is 64-bit). Note that it is not an absolute address.
* Return non-zero if success, zero if failed.
*/
WASM_RUNTIME_API_EXTERN uint64_t
wasm_runtime_shared_heap_malloc(wasm_module_inst_t module_inst, uint64_t size,
void **p_native_addr);
WASM_RUNTIME_API_EXTERN uint64_t wasm_runtime_shared_heap_malloc(
wasm_module_inst_t module_inst, uint64_t size, void **p_native_addr);
/**
* Free the memory allocated from shared heap, or the non-preallocated shared