Merge branch main into dev/shared_heap
This commit is contained in:
@ -120,6 +120,10 @@ typedef struct WASMModuleInstanceCommon *wasm_module_inst_t;
|
||||
typedef void WASMFunctionInstanceCommon;
|
||||
typedef WASMFunctionInstanceCommon *wasm_function_inst_t;
|
||||
|
||||
/* Memory instance */
|
||||
struct WASMMemoryInstance;
|
||||
typedef struct WASMMemoryInstance *wasm_memory_inst_t;
|
||||
|
||||
/* WASM section */
|
||||
typedef struct wasm_section_t {
|
||||
struct wasm_section_t *next;
|
||||
@ -251,6 +255,11 @@ typedef struct LoadArgs {
|
||||
const strings), making it possible to free the wasm binary buffer after
|
||||
loading. */
|
||||
bool wasm_binary_freeable;
|
||||
|
||||
/* false by default, if true, don't resolve the symbols yet. The
|
||||
wasm_runtime_load_ex has to be followed by a wasm_runtime_resolve_symbols
|
||||
call */
|
||||
bool no_resolve;
|
||||
/* TODO: more fields? */
|
||||
} LoadArgs;
|
||||
#endif /* LOAD_ARGS_OPTION_DEFINED */
|
||||
@ -572,6 +581,12 @@ WASM_RUNTIME_API_EXTERN wasm_module_t
|
||||
wasm_runtime_load_ex(uint8_t *buf, uint32_t size, const LoadArgs *args,
|
||||
char *error_buf, uint32_t error_buf_size);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
/**
|
||||
* Load a WASM module from a specified WASM or AOT section list.
|
||||
*
|
||||
@ -946,6 +961,100 @@ WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_module_inst(wasm_exec_env_t exec_env,
|
||||
const wasm_module_inst_t module_inst);
|
||||
|
||||
/**
|
||||
* @brief Lookup a memory instance by name
|
||||
*
|
||||
* @param module_inst The module instance
|
||||
* @param name The name of the memory instance
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* @brief Get the default memory instance
|
||||
*
|
||||
* @param module_inst The module instance
|
||||
*
|
||||
* @return The memory instance if found, NULL otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t
|
||||
wasm_runtime_get_default_memory(const wasm_module_inst_t module_inst);
|
||||
|
||||
/**
|
||||
* @brief Get a memory instance by index
|
||||
*
|
||||
* @param module_inst The module instance
|
||||
* @param index The index of the memory instance
|
||||
*
|
||||
* @return The memory instance if found, NULL otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN wasm_memory_inst_t
|
||||
wasm_runtime_get_memory(const wasm_module_inst_t module_inst, uint32_t index);
|
||||
|
||||
/**
|
||||
* @brief Get the current number of pages for a memory instance
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
*
|
||||
* @return The current number of pages
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_memory_get_cur_page_count(const wasm_memory_inst_t memory_inst);
|
||||
|
||||
/**
|
||||
* @brief Get the maximum number of pages for a memory instance
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
*
|
||||
* @return The maximum number of pages
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_memory_get_max_page_count(const wasm_memory_inst_t memory_inst);
|
||||
|
||||
/**
|
||||
* @brief Get the number of bytes per page for a memory instance
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
*
|
||||
* @return The number of bytes per page
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN uint64_t
|
||||
wasm_memory_get_bytes_per_page(const wasm_memory_inst_t memory_inst);
|
||||
|
||||
/**
|
||||
* @brief Get the shared status for a memory instance
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
*
|
||||
* @return True if shared, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_memory_get_shared(const wasm_memory_inst_t memory_inst);
|
||||
|
||||
/**
|
||||
* @brief Get the base address for a memory instance
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
*
|
||||
* @return The base address on success, false otherwise
|
||||
*/
|
||||
WASM_RUNTIME_API_EXTERN void *
|
||||
wasm_memory_get_base_address(const wasm_memory_inst_t memory_inst);
|
||||
|
||||
/**
|
||||
* @brief Enlarge a memory instance by a number of pages
|
||||
*
|
||||
* @param memory_inst The memory instance
|
||||
* @param inc_page_count The number of pages to add
|
||||
*
|
||||
* @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);
|
||||
|
||||
/**
|
||||
* Call the given WASM function of a WASM module instance with
|
||||
* arguments (bytecode and AoT).
|
||||
|
||||
Reference in New Issue
Block a user