introduce wasm_runtime_instantiate_ex2 (#4444)
* introduce wasm_runtime_instantiate_ex2 at this point, just a slightly inefficiant functionality equivalent of wasm_runtime_instantiate_ex. however, unlike wasm_runtime_instantiate_ex, this one is designed to be extendable without breaking the user-visible ABI. because the definition of InstantiationArgs2 is not exposed to users, we can safely add new members to it. this commit also makes wasm_runtime_instantiate_ex a wrapper of wasm_runtime_instantiate_ex2. if this goes well, maybe it's a good idea to apply a similar pattern to RuntimeInitArgs, LoadArgs, SharedHeapInitArgs, etc. i started with InstantiationArgs just because i happen to have a need to extend it for wasi-nn. cf. https://github.com/bytecodealliance/wasm-micro-runtime/issues/4364 https://github.com/bytecodealliance/wasm-micro-runtime/issues/4331 * product-mini/platforms/posix: use wasm_runtime_instantiate_ex2
This commit is contained in:
@ -612,6 +612,10 @@ WASMExecEnv *
|
||||
wasm_runtime_get_exec_env_tls(void);
|
||||
#endif
|
||||
|
||||
struct InstantiationArgs2 {
|
||||
InstantiationArgs v1;
|
||||
};
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_init(void);
|
||||
@ -700,6 +704,40 @@ wasm_runtime_instantiate_ex(WASMModuleCommon *module,
|
||||
const InstantiationArgs *args, char *error_buf,
|
||||
uint32 error_buf_size);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
bool
|
||||
wasm_runtime_instantiation_args_create(struct InstantiationArgs2 **p);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_destroy(struct InstantiationArgs2 *p);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_default_stack_size(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_host_managed_heap_size(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN
|
||||
void
|
||||
wasm_runtime_instantiation_args_set_max_memory_pages(
|
||||
struct InstantiationArgs2 *p, uint32 v);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
|
||||
wasm_runtime_instantiate_ex2(WASMModuleCommon *module,
|
||||
const struct InstantiationArgs2 *args,
|
||||
char *error_buf, uint32 error_buf_size);
|
||||
|
||||
/* See wasm_export.h for description */
|
||||
WASM_RUNTIME_API_EXTERN bool
|
||||
wasm_runtime_set_running_mode(wasm_module_inst_t module_inst,
|
||||
|
||||
Reference in New Issue
Block a user