@@ -457,7 +457,7 @@ aot_call_function(WASMExecEnv *exec_env,
457457 AOTModuleInstance * module_inst = (AOTModuleInstance * )exec_env -> module_inst ;
458458 AOTFuncType * func_type = function -> func_type ;
459459 bool ret = wasm_runtime_invoke_native (exec_env , function -> func_ptr ,
460- func_type , NULL , argv , argc , argv );
460+ func_type , NULL , NULL , argv , argc , argv );
461461 return ret && !aot_get_exception (module_inst ) ? true : false;
462462}
463463
@@ -824,7 +824,8 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
824824 void * * func_ptrs = (void * * )module_inst -> func_ptrs .ptr ;
825825 void * func_ptr = func_ptrs [func_idx ];
826826 AOTImportFunc * import_func ;
827- const char * signature = NULL ;
827+ const char * signature ;
828+ void * attachment ;
828829 char buf [128 ];
829830
830831 bh_assert (func_idx < aot_module -> import_func_count );
@@ -839,9 +840,17 @@ aot_invoke_native(WASMExecEnv *exec_env, uint32 func_idx,
839840 }
840841
841842 signature = import_func -> signature ;
842- return wasm_runtime_invoke_native (exec_env , func_ptr ,
843- func_type , signature ,
844- frame_lp , argc , argv_ret );
843+ attachment = import_func -> attachment ;
844+ if (!import_func -> call_conv_raw ) {
845+ return wasm_runtime_invoke_native (exec_env , func_ptr ,
846+ func_type , signature , attachment ,
847+ frame_lp , argc , argv_ret );
848+ }
849+ else {
850+ return wasm_runtime_invoke_native_raw (exec_env , func_ptr ,
851+ func_type , signature , attachment ,
852+ frame_lp , argc , argv_ret );
853+ }
845854}
846855
847856bool
@@ -860,6 +869,7 @@ aot_call_indirect(WASMExecEnv *exec_env,
860869 uint32 func_idx , func_type_idx1 ;
861870 AOTImportFunc * import_func ;
862871 const char * signature = NULL ;
872+ void * attachment = NULL ;
863873 char buf [128 ];
864874
865875 if (table_elem_idx >= table_size ) {
@@ -879,12 +889,6 @@ aot_call_indirect(WASMExecEnv *exec_env,
879889 return false;
880890 }
881891
882- if (func_idx < aot_module -> import_func_count ) {
883- /* Call native function */
884- import_func = aot_module -> import_funcs + func_idx ;
885- signature = import_func -> signature ;
886- }
887-
888892 if (!(func_ptr = func_ptrs [func_idx ])) {
889893 bh_assert (func_idx < aot_module -> import_func_count );
890894 import_func = aot_module -> import_funcs + func_idx ;
@@ -895,8 +899,20 @@ aot_call_indirect(WASMExecEnv *exec_env,
895899 return false;
896900 }
897901
902+ if (func_idx < aot_module -> import_func_count ) {
903+ /* Call native function */
904+ import_func = aot_module -> import_funcs + func_idx ;
905+ signature = import_func -> signature ;
906+ if (import_func -> call_conv_raw ) {
907+ attachment = import_func -> attachment ;
908+ return wasm_runtime_invoke_native_raw (exec_env , func_ptr ,
909+ func_type , signature , attachment ,
910+ frame_lp , argc , argv_ret );
911+ }
912+ }
913+
898914 return wasm_runtime_invoke_native (exec_env , func_ptr ,
899- func_type , signature ,
915+ func_type , signature , attachment ,
900916 frame_lp , argc , argv_ret );
901917}
902918
0 commit comments