Expose wasm_runtime_call_indirect (#1969)

The function has been there for long. While what it does look a bit unsafe
as it calls a function which may be not wasm-wise exported explicitly, it's
useful and widely used when implementing callback-taking APIs, including
our pthread_create's implementation.
This commit is contained in:
YAMAMOTO Takashi
2023-02-20 19:56:55 +09:00
committed by GitHub
parent e516de8ec7
commit 37b09d0f24
6 changed files with 33 additions and 36 deletions

View File

@ -4346,7 +4346,7 @@ fail:
|| defined(BUILD_TARGET_RISCV64_LP64) */
bool
wasm_runtime_call_indirect(WASMExecEnv *exec_env, uint32 element_indices,
wasm_runtime_call_indirect(WASMExecEnv *exec_env, uint32 element_index,
uint32 argc, uint32 argv[])
{
bool ret = false;
@ -4362,11 +4362,11 @@ wasm_runtime_call_indirect(WASMExecEnv *exec_env, uint32 element_indices,
#if WASM_ENABLE_INTERP != 0
if (exec_env->module_inst->module_type == Wasm_Module_Bytecode)
ret = wasm_call_indirect(exec_env, 0, element_indices, argc, argv);
ret = wasm_call_indirect(exec_env, 0, element_index, argc, argv);
#endif
#if WASM_ENABLE_AOT != 0
if (exec_env->module_inst->module_type == Wasm_Module_AoT)
ret = aot_call_indirect(exec_env, 0, element_indices, argc, argv);
ret = aot_call_indirect(exec_env, 0, element_index, argc, argv);
#endif
if (!ret && clear_wasi_proc_exit_exception(exec_env->module_inst)) {