Remove unused argument in wasm_runtime_lookup_function and refactor WASMModuleInstance (#3218)

Remove the unused parameter `signature` from `wasm_runtime_lookup_function`.

Refactor the layout of WASMModuleInstance structure:
- move common data members `c_api_func_imports` and `cur_exec_env` from
  `WASMModuleInstanceExtraCommon` to `WASMModuleInstance`
- In `WASMModuleInstance`, enlarge `reserved[3]` to `reserved[5]` in case that
  we need to add more fields in the future

ps.
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2530
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3202
This commit is contained in:
TianlongLiang
2024-03-13 12:28:45 +08:00
committed by GitHub
parent ce44e0ec0c
commit c3e33a96ea
28 changed files with 100 additions and 136 deletions

View File

@ -65,14 +65,12 @@ app_instance_main(wasm_module_inst_t module_inst)
wasm_exec_env_t exec_env;
unsigned argv[2] = { 0 };
if (wasm_runtime_lookup_function(module_inst, "main", NULL)
|| wasm_runtime_lookup_function(module_inst, "__main_argc_argv",
NULL)) {
if (wasm_runtime_lookup_function(module_inst, "main")
|| wasm_runtime_lookup_function(module_inst, "__main_argc_argv")) {
LOG_VERBOSE("Calling main function\n");
wasm_application_execute_main(module_inst, app_argc, app_argv);
}
else if ((func = wasm_runtime_lookup_function(module_inst, "app_main",
NULL))) {
else if ((func = wasm_runtime_lookup_function(module_inst, "app_main"))) {
exec_env =
wasm_runtime_create_exec_env(module_inst, CONFIG_APP_HEAP_SIZE);
if (!exec_env) {