Get the exported APIs of base lib
Get the package type of a buffer.
Find the specified function in argv[0] from a WASM module instance
and execute that function.
Find the unique main function from a WASM module instance
and execute that function.
Map external object to an internal externref index: if the index
has been created, return it, otherwise create the index.
Delete external object registered by wasm_externref_obj2ref
.
Retrieve the external object from an internal externref index
Retain an extern object which is mapped to the internal externref
so that the object won’t be cleaned during extern object reclaim
if it isn’t used.
Set cleanup callback to release external object.
Get parameter count of the function instance
Get parameter types of the function instance
Get result count of the function instance
Get result types of the function instance
Get the number of parameters for a function type
Get the kind of a parameter for a function type
Get the number of results for a function type
Get the kind of a result for a function type
Get the mutability for a global type
Get the kind for a global type
Get the initial page count for a memory type
Get the maximum page count for a memory type
Get the shared setting for a memory type
Convert app address (relative address) to native address (absolute address)
Convert native address (absolute address) to app address (relative address)
Call a function reference of a given WASM runtime instance with
arguments.
Call the given WASM function of a WASM module instance with
arguments (bytecode and AoT).
Call the given WASM function of a WASM module instance with
provided results space and arguments (bytecode and AoT).
Call the given WASM function of a WASM module instance with
provided results space and variant arguments (bytecode and AoT).
Clear exception info of the WASM module instance.
Create execution environment for a WASM module instance.
Deinstantiate a WASM module instance, destroy the resources.
Destroy the WASM runtime environment.
Destroy the execution environment.
Destroy the spawned exec_env
Destroy the thread environment
Dump the call stack to stdout
Dump the call stack to buffer.
Dump runtime memory consumption, including:
Exec env memory consumption
WASM module memory consumption
WASM module instance memory consumption
stack and app heap used info
Dump runtime performance profiler data of each function
Dump the LLVM PGO profile data to buffer
Enlarge the memory region for a module instance
Check if there is already a loaded module named module_name in the
runtime. Repeatedly loading a module with the same name is not allowed.
Initialize the WASM runtime environment, WASM running mode,
and also initialize the memory allocator and register native symbols,
which are specified with init arguments
Get the app address range (relative address) that a app address belongs to
Get the size required to store the call stack contents, including
the space for terminating null byte (‘\0’)
Get the currently supported version of the package type
Get the custom data within a WASM module instance.
Get a custom section by name
Get exception info of the WASM module instance.
Get the singleton execution environment for the instance.
Get the number of export items for a WASM module
Get an export global instance
Get an export table instance
Get information about a specific WASM module export
Get the package type of a buffer (same as get_package_type).
Get the package version of a buffer.
Get attachment of native function from execution environment
Get the number of import items for a WASM module
Get information about a specific WASM module import
Get WASM module from WASM module instance
Get the module hash of a WASM module, currently only available on
linux-sgx platform when the remote attestation feature is enabled
Get WASM module instance from execution environment
Get the package type of a module.
Get the package version of a module
Get the native address range (absolute address) that a native address
belongs to
Get the size required to store the LLVM PGO profile data
Get the running mode of a WASM module instance, if no running mode
is explicitly set the default running mode of runtime will
be used and returned. Note that it only makes sense when the input is a
wasm bytecode file: for the AOT file, this function always returns 0.
Get the user data within execution environment.
Get WAMR semantic version
Get WASI exit code.
Return execution time in ms of a given wasm function with
func_name. If the function is not found, return 0.
Initialize the WASM runtime environment, and also initialize
the memory allocator with system allocator, which calls os_malloc
to allocate memory
Initialize the thread environment.
Note:
If developer creates a child thread by himself to call the
the wasm function in that thread, he should call this API
firstly before calling the wasm function and then call
wasm_runtime_destroy_thread_env() after calling the wasm
function. If the thread is created from the runtime API,
it is unnecessary to call these two APIs.
Instantiate a WASM module.
Instantiate a WASM module, with specified instantiation arguments
Check if the memory bounds checks flag is enabled for a WASM module instance.
Check whether an import func (import <module_name> <func_name> (func ...))
is linked or not with runtime registered native functions
Check whether an import global (import <module_name> <global_name> (global ...))
is linked or not with runtime registered native globals
Query whether a certain running mode is supported for the runtime
Query whether the wasm binary buffer used to create the module can be freed
Check whether a file is an AOT XIP (Execution In Place) file
Wait a spawned thread to terminate
Load a WASM module from a specified byte buffer. The byte buffer can be
WASM binary data when interpreter or JIT is enabled, or AOT binary data
when AOT is enabled. If it is AOT binary data, it must be 4-byte aligned.
Load a WASM module with specified load argument.
Load a WASM module from a specified WASM or AOT section list.
Lookup an exported function in the WASM module instance.
Allocate memory from runtime memory environment.
Allocate memory from the heap of WASM module instance and initialize
the memory with src
Free memory to the heap of WASM module instance
Allocate memory from the heap of WASM module instance
Reallocate memory from runtime memory environment
Give the “module” a name “module_name”.
Can not assign a new name to a module if it already has a name
Register native functions with same module name
Register native functions with same module name, similar to
wasm_runtime_register_natives, the difference is that runtime passes raw
arguments to native API, which means that the native API should be defined as
void foo(wasm_exec_env_t exec_env, uint64 *args);
and native API should extract arguments one by one from args array with macro
native_raw_get_arg
and write the return value back to args[0] with macro
native_raw_return_type and native_raw_set_return
Set the memory bounds checks flag of a WASM module instance.
Set custom data to WASM module instance.
Note:
If WAMR_BUILD_LIB_PTHREAD is enabled, this API
will spread the custom data to all threads
Set the default running mode for the runtime. It is inherited
to set the running mode of a module instance when it is instantiated,
and can be changed by calling wasm_runtime_set_running_mode
Setup callback invoked when memory.grow fails
Set exception info of the WASM module instance.
Set the log level. To be called after the runtime is initialized.
Set the max thread num per cluster.
Set WASM module instance of execution environment
Caution:
normally the module instance is bound with the execution
environment one by one, if multiple module instances want
to share to the same execution environment, developer should
be responsible for the backup and restore of module instance
Setup callbacks for reading and releasing a buffer about a module file
Set the running mode of a WASM module instance, override the
default running mode of the runtime. Note that it only makes sense when
the input is a wasm bytecode file: for the AOT file, runtime always runs
it with AOT engine, and this function always returns true.
Set user data to execution environment.
Set WASI parameters.
Set WASI parameters.
Spawn a new exec_env, the spawned exec_env
can be used in other threads
Spawn a thread from the given exec_env
Same as wasm_runtime_start_debug_instance_with_port(env, -1).
Start debug instance based on given execution environment.
Note:
The debug instance will be destroyed during destroying the
execution environment, developers don’t need to destroy it
manually.
If the cluster of this execution environment has already
been bound to a debug instance, this function will return true
directly.
If developer spawns some exec_env by wasm_runtime_spawn_exec_env,
don’t need to call this function for every spawned exec_env as
they are sharing the same cluster with the main exec_env.
Return total wasm functions’ execution time in ms
Terminate the WASM module instance.
Whether the thread environment is initialized
Unload a WASM module.
Undo wasm_runtime_register_natives or wasm_runtime_register_natives_raw
Validate the app address, check whether it belongs to WASM module
instance’s address space, or in its heap space or memory space.
Similar to wasm_runtime_validate_app_addr(), except that the size parameter
is not provided. This function validates the app string address, check
whether it belongs to WASM module instance’s address space, or in its heap
space or memory space. Moreover, it checks whether it is the offset of a
string that is end with ‘\0’.
Validate the native address, check whether it belongs to WASM module
instance’s address space, or in its heap space or memory space.
Get a function instance from a table.
Get the element kind for a table type
Get the initial size for a table type
Get the maximum size for a table type
Get the sharing setting for a table type