Skip to content

Commit

Permalink
Enable quick aot entry when GC is enabled (#3015)
Browse files Browse the repository at this point in the history
- Set gc func type's quick_aot_entry
- Call quick_aot_entry when hw bound check is disabled
- Declare detailed aot func's prototype inside the quick aot entry
- Remove ret_type in the quick aot entry
- Update docker image
  • Loading branch information
wenyongh committed Jan 18, 2024
1 parent 6440445 commit 4f0551a
Show file tree
Hide file tree
Showing 6 changed files with 427 additions and 465 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/spec_test_on_nuttx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ jobs:
with:
os: "ubuntu-22.04"
arch: "ARM RISCV AArch64"
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux:latest
container_image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9

spec_test_on_qemu:
runs-on: ubuntu-latest
needs: [build_llvm_libraries]
container:
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux:latest
image: ghcr.io/no1wudi/nuttx/apache-nuttx-ci-linux@sha256:8c4e00b607d4d6d66ba8f51c4544819a616eac69d3a2ac669e2af2150e2eb0f9
strategy:
matrix:
target_config: [
Expand Down
5 changes: 5 additions & 0 deletions core/iwasm/aot/aot_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,11 @@ load_types(const uint8 **p_buf, const uint8 *buf_end, AOTModule *module,
func_type->param_cell_num = param_cell_num;
func_type->ret_cell_num = ret_cell_num;

#if WASM_ENABLE_QUICK_AOT_ENTRY != 0
func_type->quick_aot_entry =
wasm_native_lookup_quick_aot_entry(func_type);
#endif

LOG_VERBOSE("type %u: func, param count: %d, result count: %d, "
"ref type map count: %d",
i, param_count, result_count, ref_type_map_count);
Expand Down
33 changes: 24 additions & 9 deletions core/iwasm/aot/aot_runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,14 +2049,10 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
#if WASM_ENABLE_QUICK_AOT_ENTRY != 0
/* Quick call if the quick aot entry is registered */
if (!signature && func_type->quick_aot_entry) {
void (*invoke_native)(
void *func_ptr, uint8 ret_type, void *exec_env, uint32 *argv,
uint32 *argv_ret) = func_type->quick_aot_entry;
invoke_native(func_ptr,
func_type->result_count > 0
? func_type->types[func_type->param_count]
: VALUE_TYPE_VOID,
exec_env, argv, argv_ret);
void (*invoke_native)(void *func_ptr, void *exec_env, uint32 *argv,
uint32 *argv_ret) =
func_type->quick_aot_entry;
invoke_native(func_ptr, exec_env, argv, argv_ret);
ret = !aot_copy_exception(module_inst, NULL);
}
else
Expand Down Expand Up @@ -2095,7 +2091,26 @@ invoke_native_with_hw_bound_check(WASMExecEnv *exec_env, void *func_ptr,
}
#define invoke_native_internal invoke_native_with_hw_bound_check
#else /* else of OS_ENABLE_HW_BOUND_CHECK */
#define invoke_native_internal wasm_runtime_invoke_native
static inline bool
invoke_native_internal(WASMExecEnv *exec_env, void *func_ptr,
const WASMFuncType *func_type, const char *signature,
void *attachment, uint32 *argv, uint32 argc,
uint32 *argv_ret)
{
#if WASM_ENABLE_QUICK_AOT_ENTRY != 0
/* Quick call if the quick aot entry is registered */
if (!signature && func_type->quick_aot_entry) {
AOTModuleInstance *module_inst =
(AOTModuleInstance *)exec_env->module_inst;
void (*invoke_native)(void *func_ptr, void *exec_env, uint32 *argv,
uint32 *argv_ret) = func_type->quick_aot_entry;
invoke_native(func_ptr, exec_env, argv, argv_ret);
return !aot_copy_exception(module_inst, NULL);
}
#endif
return wasm_runtime_invoke_native(exec_env, func_ptr, func_type, signature,
attachment, argv, argc, argv_ret);
}
#endif /* end of OS_ENABLE_HW_BOUND_CHECK */

#ifdef AOT_STACK_FRAME_DEBUG
Expand Down
Loading

0 comments on commit 4f0551a

Please sign in to comment.