Refine AOT/JIT code call wasm-c-api import process (#2982)

Allow to invoke the quick call entry wasm_runtime_quick_invoke_c_api_import to
call the wasm-c-api import functions to speedup the calling process, which reduces
the data copying.

Use `wamrc --invoke-c-api-import` to generate the optimized AOT code, and set
`jit_options->quick_invoke_c_api_import` true in wasm_engine_new when LLVM JIT
is enabled.
This commit is contained in:
Wenyong Huang
2024-01-10 18:37:02 +08:00
committed by GitHub
parent 7c7684819d
commit b21f17dd6d
20 changed files with 393 additions and 35 deletions

View File

@ -2852,7 +2852,7 @@ static bool
init_llvm_jit_functions_stage1(WASMModule *module, char *error_buf,
uint32 error_buf_size)
{
LLVMJITOptions llvm_jit_options = wasm_runtime_get_llvm_jit_options();
LLVMJITOptions *llvm_jit_options = wasm_runtime_get_llvm_jit_options();
AOTCompOption option = { 0 };
char *aot_last_error;
uint64 size;
@ -2892,10 +2892,11 @@ init_llvm_jit_functions_stage1(WASMModule *module, char *error_buf,
option.is_jit_mode = true;
llvm_jit_options = wasm_runtime_get_llvm_jit_options();
option.opt_level = llvm_jit_options.opt_level;
option.size_level = llvm_jit_options.size_level;
option.segue_flags = llvm_jit_options.segue_flags;
option.opt_level = llvm_jit_options->opt_level;
option.size_level = llvm_jit_options->size_level;
option.segue_flags = llvm_jit_options->segue_flags;
option.quick_invoke_c_api_import =
llvm_jit_options->quick_invoke_c_api_import;
#if WASM_ENABLE_BULK_MEMORY != 0
option.enable_bulk_memory = true;