@@ -1325,6 +1325,9 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
13251325 uint32 result_count = func_type -> result_count ;
13261326 uint32 ext_ret_count = result_count > 1 ? result_count - 1 : 0 ;
13271327 bool ret ;
1328+ #ifdef OS_ENABLE_BLOCK_INSN_INTERRUPT
1329+ WASMJmpBuf jmpbuf_node = { 0 }, * jmpbuf_node_pop ;
1330+ #endif
13281331
13291332 if (argc < func_type -> param_cell_num ) {
13301333 char buf [108 ];
@@ -1385,8 +1388,19 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
13851388 }
13861389#endif
13871390
1388- ret = invoke_native_internal (exec_env , function -> u .func .func_ptr ,
1389- func_type , NULL , NULL , argv1 , argc , argv );
1391+ #ifdef OS_ENABLE_BLOCK_INSN_INTERRUPT
1392+ wasm_exec_env_push_jmpbuf (exec_env , & jmpbuf_node );
1393+ wasm_runtime_set_exec_env_tls (exec_env );
1394+ if (os_setjmp (jmpbuf_node .jmpbuf ) == 0 )
1395+ #endif
1396+ ret = invoke_native_internal (exec_env , function -> u .func .func_ptr ,
1397+ func_type , NULL , NULL , argv1 , argc ,
1398+ argv );
1399+ #ifdef OS_ENABLE_BLOCK_INSN_INTERRUPT
1400+
1401+ jmpbuf_node_pop = wasm_exec_env_pop_jmpbuf (exec_env );
1402+ bh_assert (& jmpbuf_node == jmpbuf_node_pop );
1403+ #endif
13901404
13911405#if WASM_ENABLE_DUMP_CALL_STACK != 0
13921406 if (!ret ) {
@@ -1444,8 +1458,19 @@ aot_call_function(WASMExecEnv *exec_env, AOTFunctionInstance *function,
14441458 }
14451459#endif
14461460
1447- ret = invoke_native_internal (exec_env , function -> u .func .func_ptr ,
1448- func_type , NULL , NULL , argv , argc , argv );
1461+ #ifdef OS_ENABLE_BLOCK_INSN_INTERRUPT
1462+ wasm_exec_env_push_jmpbuf (exec_env , & jmpbuf_node );
1463+ wasm_runtime_set_exec_env_tls (exec_env );
1464+ if (os_setjmp (jmpbuf_node .jmpbuf ) == 0 )
1465+ #endif
1466+ ret =
1467+ invoke_native_internal (exec_env , function -> u .func .func_ptr ,
1468+ func_type , NULL , NULL , argv , argc , argv );
1469+ #ifdef OS_ENABLE_BLOCK_INSN_INTERRUPT
1470+
1471+ jmpbuf_node_pop = wasm_exec_env_pop_jmpbuf (exec_env );
1472+ bh_assert (& jmpbuf_node == jmpbuf_node_pop );
1473+ #endif
14491474
14501475#if WASM_ENABLE_DUMP_CALL_STACK != 0
14511476 if (aot_get_exception (module_inst )) {
@@ -1471,7 +1496,7 @@ aot_create_exec_env_and_call_function(AOTModuleInstance *module_inst,
14711496 WASMExecEnv * exec_env = NULL , * existing_exec_env = NULL ;
14721497 bool ret ;
14731498
1474- #if defined(OS_ENABLE_HW_BOUND_CHECK )
1499+ #if defined(OS_ENABLE_HW_BOUND_CHECK ) || defined( OS_ENABLE_BLOCK_INSN_INTERRUPT )
14751500 existing_exec_env = exec_env = wasm_runtime_get_exec_env_tls ();
14761501#elif WASM_ENABLE_THREAD_MGR != 0
14771502 existing_exec_env = exec_env =
0 commit comments