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:
liang.he
2024-04-07 15:04:35 +08:00
committed by GitHub
parent cee9b826a5
commit 4ef724bbff
28 changed files with 3008 additions and 346 deletions

View File

@ -2994,7 +2994,7 @@ load_from_sections(WASMModule *module, WASMSection *sections,
}
static WASMModule *
create_module(char *error_buf, uint32 error_buf_size)
create_module(char *name, char *error_buf, uint32 error_buf_size)
{
WASMModule *module =
loader_malloc(sizeof(WASMModule), error_buf, error_buf_size);
@ -3009,7 +3009,7 @@ create_module(char *error_buf, uint32 error_buf_size)
/* Set start_function to -1, means no start function */
module->start_function = (uint32)-1;
module->name = "";
module->name = name;
#if WASM_ENABLE_FAST_INTERP == 0
module->br_table_cache_list = &module->br_table_cache_list_head;
@ -3035,7 +3035,7 @@ WASMModule *
wasm_loader_load_from_sections(WASMSection *section_list, char *error_buf,
uint32 error_buf_size)
{
WASMModule *module = create_module(error_buf, error_buf_size);
WASMModule *module = create_module("", error_buf, error_buf_size);
if (!module)
return NULL;
@ -3206,10 +3206,10 @@ load(const uint8 *buf, uint32 size, WASMModule *module, char *error_buf,
}
WASMModule *
wasm_loader_load(uint8 *buf, uint32 size, char *error_buf,
wasm_loader_load(uint8 *buf, uint32 size, const LoadArgs *args, char *error_buf,
uint32 error_buf_size)
{
WASMModule *module = create_module(error_buf, error_buf_size);
WASMModule *module = create_module(args->name, error_buf, error_buf_size);
if (!module) {
return NULL;
}