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

@ -378,6 +378,9 @@ wasm_engine_new_internal(wasm_config_t *config)
wasm_engine_t *engine = NULL;
/* init runtime */
RuntimeInitArgs init_args = { 0 };
#if WASM_ENABLE_JIT != 0
LLVMJITOptions *jit_options = wasm_runtime_get_llvm_jit_options();
#endif
#ifndef NDEBUG
bh_log_set_verbose_level(BH_LOG_LEVEL_VERBOSE);
@ -394,6 +397,10 @@ wasm_engine_new_internal(wasm_config_t *config)
init_args.enable_linux_perf = config->enable_linux_perf;
init_args.segue_flags = config->segue_flags;
#if WASM_ENABLE_JIT != 0
jit_options->quick_invoke_c_api_import = true;
#endif
if (!wasm_runtime_full_init(&init_args)) {
LOG_DEBUG("wasm_runtime_full_init failed");
goto failed;