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

@ -129,8 +129,7 @@ func (self *Instance) CallFunc(funcName string,
cName := C.CString(funcName)
defer C.free(unsafe.Pointer(cName))
_func = C.wasm_runtime_lookup_function(self._instance,
cName, (*C.char)(C.NULL))
_func = C.wasm_runtime_lookup_function(self._instance, cName)
if _func == nil {
return fmt.Errorf("CallFunc error: lookup function failed")
}
@ -170,8 +169,7 @@ func (self *Instance) CallFuncV(funcName string,
cName := C.CString(funcName)
defer C.free(unsafe.Pointer(cName))
_func = C.wasm_runtime_lookup_function(self._instance,
cName, (*C.char)(C.NULL))
_func = C.wasm_runtime_lookup_function(self._instance, cName)
if _func == nil {
return fmt.Errorf("CallFunc error: lookup function failed")
}

View File

@ -175,7 +175,7 @@ class Instance:
wasm_runtime_module_free(self.module_inst, wasm_handler)
def lookup_function(self, name: str) -> wasm_function_inst_t:
func = wasm_runtime_lookup_function(self.module_inst, name, None)
func = wasm_runtime_lookup_function(self.module_inst, name)
if not func:
raise Exception("Error while looking-up function")
return func