@@ -53,7 +53,7 @@ bh_static_assert(offsetof(AOTModuleInstance, c_api_func_imports)
5353bh_static_assert (offsetof(AOTModuleInstance , global_table_data )
5454 == 13 * sizeof (uint64 ) + 128 + 14 * sizeof (uint64 ));
5555
56- bh_static_assert (sizeof (AOTMemoryInstance ) == 120 );
56+ bh_static_assert (sizeof (AOTMemoryInstance ) == 128 );
5757bh_static_assert (offsetof(AOTTableInstance , elems ) == 24 );
5858
5959bh_static_assert (offsetof(AOTModuleInstanceExtra , stack_sizes ) == 0 );
@@ -2013,19 +2013,6 @@ aot_lookup_global(const AOTModuleInstance *module_inst, const char *name)
20132013 return NULL ;
20142014}
20152015
2016- AOTGlobalInstance *
2017- aot_lookup_global (const AOTModuleInstance * module_inst , const char * name )
2018- {
2019- uint32 i ;
2020- AOTGlobalInstance * export_globs =
2021- (AOTGlobalInstance * )module_inst -> export_globals ;
2022-
2023- for (i = 0 ; i < module_inst -> export_global_count ; i ++ )
2024- if (!strcmp (export_globs [i ].name , name ))
2025- return & export_globs [i ];
2026- return NULL ;
2027- }
2028-
20292016#ifdef OS_ENABLE_HW_BOUND_CHECK
20302017static bool
20312018invoke_native_with_hw_bound_check (WASMExecEnv * exec_env , void * func_ptr ,
@@ -2416,7 +2403,7 @@ aot_poll_pending_signal(WASMExecEnv *exec_env)
24162403 /* Patch function pointer in case of reassignment */
24172404 uint32 func_idx = wali_sigtable [signo ].func_idx ;
24182405 uint32 func_type_idx = module_inst -> func_type_indexes [func_idx ];
2419- sigfn -> u .func .func_type = ((AOTModule * )module_inst -> module )-> func_types [func_type_idx ];
2406+ sigfn -> u .func .func_type = ((AOTModule * )module_inst -> module )-> types [func_type_idx ];
24202407 sigfn -> u .func .func_ptr = module_inst -> func_ptrs [func_idx ];
24212408 /* */
24222409 pthread_mutex_unlock (& sigtable_mut );
@@ -2868,8 +2855,9 @@ aot_get_indirect_function (AOTModuleInstance *module_inst, uint32 tbl_idx,
28682855
28692856 AOTModule * aot_module = (AOTModule * )module_inst -> module ;
28702857 AOTTableInstance * tbl_inst = NULL ;
2871- uint32 func_idx = NULL_REF ;
2858+ table_elem_type_t tbl_elem_val = NULL_REF ;
28722859 uint32 * func_type_indexes = module_inst -> func_type_indexes ;
2860+ uint32 func_idx ;
28732861 uint32 func_type_idx ;
28742862 void * * func_ptrs = module_inst -> func_ptrs ;
28752863
@@ -2880,14 +2868,21 @@ aot_get_indirect_function (AOTModuleInstance *module_inst, uint32 tbl_idx,
28802868 goto fail ;
28812869 }
28822870
2883- func_idx = tbl_inst -> elems [table_elem_idx ];
2884- if (func_idx == NULL_REF ) {
2871+ tbl_elem_val = tbl_inst -> elems [table_elem_idx ];
2872+ if (tbl_elem_val == NULL_REF ) {
28852873 aot_set_exception_with_id (module_inst , EXCE_UNINITIALIZED_ELEMENT );
28862874 goto fail ;
28872875 }
28882876
2877+ #if WASM_ENABLE_GC == 0
2878+ func_idx = tbl_elem_val ;
2879+ #else
2880+ func_idx =
2881+ wasm_func_obj_get_func_idx_bound ((WASMFuncObjectRef )tbl_elem_val );
2882+ #endif
2883+
28892884 func_type_idx = func_type_indexes [func_idx ];
2890- * func_type_addr = aot_module -> func_types [func_type_idx ];
2885+ * func_type_addr = aot_module -> types [func_type_idx ];
28912886
28922887 if (func_idx >= aot_module -> import_func_count ) {
28932888 /* func pointer was looked up previously */
@@ -2913,8 +2908,7 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
29132908 AOTModule * aot_module = (AOTModule * )module_inst -> module ;
29142909 AOTFuncType * func_type ;
29152910 void * * func_ptrs = module_inst -> func_ptrs , * func_ptr ;
2916- uint32 func_type_idx , func_idx , ext_ret_count ;
2917- table_elem_type_t tbl_elem_val = NULL_REF ;
2911+ uint32 func_idx , ext_ret_count ;
29182912 AOTImportFunc * import_func ;
29192913 const char * signature = NULL ;
29202914 void * attachment = NULL ;
@@ -2937,27 +2931,6 @@ aot_call_indirect(WASMExecEnv *exec_env, uint32 tbl_idx, uint32 table_elem_idx,
29372931 goto fail ;
29382932 }
29392933
2940- tbl_elem_val = ((table_elem_type_t * )tbl_inst -> elems )[table_elem_idx ];
2941- if (tbl_elem_val == NULL_REF ) {
2942- aot_set_exception_with_id (module_inst , EXCE_UNINITIALIZED_ELEMENT );
2943- goto fail ;
2944- }
2945-
2946- #if WASM_ENABLE_GC == 0
2947- func_idx = tbl_elem_val ;
2948- #else
2949- func_idx =
2950- wasm_func_obj_get_func_idx_bound ((WASMFuncObjectRef )tbl_elem_val );
2951- #endif
2952-
2953- func_type_idx = func_type_indexes [func_idx ];
2954- func_type = (AOTFuncType * )aot_module -> types [func_type_idx ];
2955-
2956- if (func_idx >= aot_module -> import_func_count ) {
2957- /* func pointer was looked up previously */
2958- bh_assert (func_ptrs [func_idx ] != NULL );
2959- }
2960-
29612934 if (!(func_ptr = func_ptrs [func_idx ])) {
29622935 bh_assert (func_idx < aot_module -> import_func_count );
29632936 import_func = aot_module -> import_funcs + func_idx ;
0 commit comments