Enhance wasm loading with LoadArgs and support module names (#3265)
- Add new API wasm_runtime_load_ex() in wasm_export.h and wasm_module_new_ex in wasm_c_api.h - Put aot_create_perf_map() into a separated file aot_perf_map.c - In perf.map, function names include user specified module name - Enhance the script to help flamegraph generations
This commit is contained in:
@ -517,10 +517,21 @@ struct WASMModuleCommon;
|
||||
typedef struct WASMModuleCommon *wasm_module_t;
|
||||
#endif
|
||||
|
||||
#ifndef LOAD_ARGS_OPTION_DEFINED
|
||||
#define LOAD_ARGS_OPTION_DEFINED
|
||||
typedef struct LoadArgs {
|
||||
char *name;
|
||||
/* TODO: more fields? */
|
||||
} LoadArgs;
|
||||
#endif /* LOAD_ARGS_OPTION_DEFINED */
|
||||
|
||||
WASM_API_EXTERN own wasm_module_t* wasm_module_new(
|
||||
wasm_store_t*, const wasm_byte_vec_t* binary);
|
||||
|
||||
// please refer to wasm_runtime_load_ex(...) in core/iwasm/include/wasm_export.h
|
||||
WASM_API_EXTERN own wasm_module_t* wasm_module_new_ex(
|
||||
wasm_store_t*, const wasm_byte_vec_t* binary, const LoadArgs *args);
|
||||
|
||||
WASM_API_EXTERN void wasm_module_delete(own wasm_module_t*);
|
||||
|
||||
WASM_API_EXTERN bool wasm_module_validate(wasm_store_t*, const wasm_byte_vec_t* binary);
|
||||
|
||||
@ -183,6 +183,14 @@ typedef struct RuntimeInitArgs {
|
||||
bool enable_linux_perf;
|
||||
} RuntimeInitArgs;
|
||||
|
||||
#ifndef LOAD_ARGS_OPTION_DEFINED
|
||||
#define LOAD_ARGS_OPTION_DEFINED
|
||||
typedef struct LoadArgs {
|
||||
char *name;
|
||||
/* TODO: more fields? */
|
||||
} LoadArgs;
|
||||
#endif /* LOAD_ARGS_OPTION_DEFINED */
|
||||
|
||||
#ifndef INSTANTIATION_ARGS_OPTION_DEFINED
|
||||
#define INSTANTIATION_ARGS_OPTION_DEFINED
|
||||
/* WASM module instantiation arguments */
|
||||
@ -419,6 +427,13 @@ 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.
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* Load a WASM module from a specified WASM or AOT section list.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user