Implement native function pointer check, addr conversion and register, update documents (#185)
Modified WASM runtime API: - wasm_runtime_module_malloc() - wasm_runtime_lookup_function() Introduced runtime API - wasm_runtime_register_natives()
This commit is contained in:
@ -726,9 +726,11 @@ wasm_interp_call_func_native(WASMModuleInstance *module_inst,
|
||||
WASMFunctionInstance *cur_func,
|
||||
WASMInterpFrame *prev_frame)
|
||||
{
|
||||
WASMFunctionImport *func_import = cur_func->u.func_import;
|
||||
unsigned local_cell_num = 2;
|
||||
WASMInterpFrame *frame;
|
||||
uint32 argv_ret[2];
|
||||
char buf[128];
|
||||
bool ret;
|
||||
|
||||
if (!(frame = ALLOC_FRAME(exec_env,
|
||||
@ -742,19 +744,16 @@ wasm_interp_call_func_native(WASMModuleInstance *module_inst,
|
||||
|
||||
wasm_exec_env_set_cur_frame(exec_env, frame);
|
||||
|
||||
if (!cur_func->u.func_import->func_ptr_linked) {
|
||||
char buf[128];
|
||||
snprintf(buf,
|
||||
sizeof(buf), "fail to call unlinked import function (%s, %s)",
|
||||
cur_func->u.func_import->module_name,
|
||||
cur_func->u.func_import->field_name);
|
||||
wasm_set_exception((WASMModuleInstance*)module_inst, buf);
|
||||
if (!func_import->func_ptr_linked) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"fail to call unlinked import function (%s, %s)",
|
||||
func_import->module_name, func_import->field_name);
|
||||
wasm_set_exception(module_inst, buf);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = wasm_runtime_invoke_native(cur_func->u.func_import->func_ptr_linked,
|
||||
cur_func->u.func_import->func_type,
|
||||
exec_env,
|
||||
ret = wasm_runtime_invoke_native(exec_env, func_import->func_ptr_linked,
|
||||
func_import->func_type, func_import->signature,
|
||||
frame->lp, cur_func->param_cell_num, argv_ret);
|
||||
|
||||
if (!ret)
|
||||
|
||||
Reference in New Issue
Block a user