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:
@ -149,8 +149,7 @@ main(int argc, char *argv_main[])
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(func = wasm_runtime_lookup_function(module_inst, "generate_float",
|
||||
NULL))) {
|
||||
if (!(func = wasm_runtime_lookup_function(module_inst, "generate_float"))) {
|
||||
printf("The generate_float wasm function is not found.\n");
|
||||
goto fail;
|
||||
}
|
||||
@ -189,8 +188,8 @@ main(int argc, char *argv_main[])
|
||||
argv2[4] = 3; // the last argument is the digits after decimal point for
|
||||
// converting float to string
|
||||
|
||||
if (!(func2 = wasm_runtime_lookup_function(module_inst, "float_to_string",
|
||||
NULL))) {
|
||||
if (!(func2 =
|
||||
wasm_runtime_lookup_function(module_inst, "float_to_string"))) {
|
||||
printf(
|
||||
"The wasm function float_to_string wasm function is not found.\n");
|
||||
goto fail;
|
||||
@ -208,7 +207,7 @@ main(int argc, char *argv_main[])
|
||||
}
|
||||
|
||||
wasm_function_inst_t func3 =
|
||||
wasm_runtime_lookup_function(module_inst, "calculate", NULL);
|
||||
wasm_runtime_lookup_function(module_inst, "calculate");
|
||||
if (!func3) {
|
||||
printf("The wasm function calculate is not found.\n");
|
||||
goto fail;
|
||||
|
||||
@ -128,7 +128,7 @@ main(int argc, char *argv_main[])
|
||||
}
|
||||
|
||||
wasm_function_inst_t func3 =
|
||||
wasm_runtime_lookup_function(module_inst, "calculate", NULL);
|
||||
wasm_runtime_lookup_function(module_inst, "calculate");
|
||||
if (!func3) {
|
||||
printf("The wasm function calculate is not found.\n");
|
||||
goto fail;
|
||||
|
||||
@ -234,19 +234,19 @@ main(int argc, char *argv[])
|
||||
|
||||
/* lookup function instance */
|
||||
if (!(wasm_cmp_externref_ptr = wasm_runtime_lookup_function(
|
||||
wasm_module_inst, "cmp-externref", NULL))) {
|
||||
wasm_module_inst, "cmp-externref"))) {
|
||||
printf("%s\n", "lookup function cmp-externref failed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(wasm_get_externref_ptr = wasm_runtime_lookup_function(
|
||||
wasm_module_inst, "get-externref", NULL))) {
|
||||
wasm_module_inst, "get-externref"))) {
|
||||
printf("%s\n", "lookup function get-externref failed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (!(wasm_set_externref_ptr = wasm_runtime_lookup_function(
|
||||
wasm_module_inst, "set-externref", NULL))) {
|
||||
wasm_module_inst, "set-externref"))) {
|
||||
printf("%s\n", "lookup function set-externref failed");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@ -104,15 +104,15 @@ main(int argc, char *argv_main[])
|
||||
goto fail;
|
||||
}
|
||||
|
||||
func_test_data_drop[i] = wasm_runtime_lookup_function(
|
||||
module_inst[i], name_test_data_drop, NULL);
|
||||
func_test_data_drop[i] =
|
||||
wasm_runtime_lookup_function(module_inst[i], name_test_data_drop);
|
||||
if (!func_test_data_drop[i]) {
|
||||
printf("The wasm function %s is not found.\n", name_test_data_drop);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
func_test_elem_drop[i] = wasm_runtime_lookup_function(
|
||||
module_inst[i], name_test_elem_drop, NULL);
|
||||
func_test_elem_drop[i] =
|
||||
wasm_runtime_lookup_function(module_inst[i], name_test_elem_drop);
|
||||
if (!func_test_elem_drop[i]) {
|
||||
printf("The wasm function %s is not found.\n", name_test_elem_drop);
|
||||
goto fail;
|
||||
|
||||
@ -29,7 +29,7 @@ thread(void *arg)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
func = wasm_runtime_lookup_function(module_inst, "sum", NULL);
|
||||
func = wasm_runtime_lookup_function(module_inst, "sum");
|
||||
if (!func) {
|
||||
printf("failed to lookup function sum");
|
||||
wasm_runtime_destroy_thread_env();
|
||||
@ -57,7 +57,7 @@ wamr_thread_cb(wasm_exec_env_t exec_env, void *arg)
|
||||
wasm_function_inst_t func;
|
||||
uint32 argv[2];
|
||||
|
||||
func = wasm_runtime_lookup_function(module_inst, "sum", NULL);
|
||||
func = wasm_runtime_lookup_function(module_inst, "sum");
|
||||
if (!func) {
|
||||
printf("failed to lookup function sum");
|
||||
return NULL;
|
||||
@ -133,7 +133,7 @@ main(int argc, char *argv[])
|
||||
goto fail4;
|
||||
}
|
||||
|
||||
func = wasm_runtime_lookup_function(wasm_module_inst, "sum", NULL);
|
||||
func = wasm_runtime_lookup_function(wasm_module_inst, "sum");
|
||||
if (!func) {
|
||||
printf("failed to lookup function sum");
|
||||
goto fail5;
|
||||
|
||||
@ -39,7 +39,7 @@ runner_with_spawn_exec_env(void *vp)
|
||||
wasm_function_inst_t func;
|
||||
bool ok = wasm_runtime_init_thread_env();
|
||||
assert(ok);
|
||||
func = wasm_runtime_lookup_function(inst, "block_forever", NULL);
|
||||
func = wasm_runtime_lookup_function(inst, "block_forever");
|
||||
assert(func != NULL);
|
||||
wasm_runtime_call_wasm(env, func, 0, NULL);
|
||||
wasm_runtime_destroy_spawned_exec_env(env);
|
||||
|
||||
Reference in New Issue
Block a user