-
Notifications
You must be signed in to change notification settings - Fork 715
Optimize for multi-module support in AOT mode #3563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optimize for multi-module support in AOT mode #3563
Conversation
* split the `aot_loader_resolve_function` into two functions to prevent redundant module lookups and loads * access pre-associated module instances from `func_module_insts`, avoiding unnecessary instances lookups and improving performance
* removed redundant NULL assignments * avoided emitting warning logs for failed function linking when multi-module is enabled
core/iwasm/aot/aot_runtime.h
Outdated
@@ -109,6 +109,7 @@ typedef struct AOTModuleInstanceExtra { | |||
#if WASM_ENABLE_MULTI_MODULE != 0 | |||
bh_list sub_module_inst_list_head; | |||
bh_list *sub_module_inst_list; | |||
WASMModuleInstanceCommon **func_module_insts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMU, sub_module_inst_list
is a list to store all AOTSubModInstNode
. Why need a new WASMModuleInstanceCommon[]
to do the same thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, sub_module_inst_list
and func_module_insts
store the same data. But func_module_insts
is indexed by the function index, which allows us to directly access the module instance without having to go through sub_module_inst_list
and lookup by name each time. sub_module_inst_list
is kept because there are still some places that require a complete and non-duplicated sub-module instances list.
* rename `func_module_insts` to `import_func_module_insts` * allocate individual memory for `import_func_module_insts` * add a function `init_import_func_module_insts` to initialize module instances of import functions, and invoke it when initializing `sub_module_list_node`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
aot_loader_resolve_function
into two functions to prevent redundant module lookups and loadsfunc_module_insts
, avoiding unnecessary instances lookups and improving performance