@@ -2318,11 +2318,45 @@ call_wasm_with_hw_bound_check(WASMModuleInstance *module_inst,
23182318 }
23192319 (void )jmpbuf_node_pop ;
23202320}
2321+ #endif /* end of OS_ENABLE_HW_BOUND_CHECK */
2322+
2323+ #ifndef OS_ENABLE_BLOCK_INSN_INTERRUPT
2324+
2325+ #ifdef OS_ENABLE_HW_BOUND_CHECK
23212326#define interp_call_wasm call_wasm_with_hw_bound_check
23222327#else
23232328#define interp_call_wasm wasm_interp_call_wasm
23242329#endif
23252330
2331+ #else /* else of OS_ENABLE_BLOCK_INSN_INTERRUPT */
2332+
2333+ #ifdef OS_ENABLE_HW_BOUND_CHECK
2334+ #define call_wasm_block_insn_interrupt call_wasm_with_hw_bound_check
2335+ #else
2336+ #define call_wasm_block_insn_interrupt wasm_interp_call_wasm
2337+ #endif
2338+
2339+ static void
2340+ interp_call_wasm (WASMModuleInstance * module_inst , WASMExecEnv * exec_env ,
2341+ WASMFunctionInstance * function , unsigned argc , uint32 argv [])
2342+ {
2343+ WASMJmpBuf jmpbuf_node = { 0 }, * jmpbuf_node_pop ;
2344+ wasm_runtime_set_exec_env_tls (exec_env );
2345+
2346+ if (os_setjmp (jmpbuf_node .jmpbuf ) == 0 ) {
2347+ wasm_exec_env_push_jmpbuf (exec_env , & jmpbuf_node );
2348+ call_wasm_block_insn_interrupt (module_inst , exec_env , function , argc ,
2349+ argv );
2350+ }
2351+
2352+ jmpbuf_node_pop = wasm_exec_env_pop_jmpbuf (exec_env );
2353+ bh_assert (& jmpbuf_node == jmpbuf_node_pop );
2354+ if (!exec_env -> jmpbuf_stack_top ) {
2355+ wasm_runtime_set_exec_env_tls (NULL );
2356+ }
2357+ }
2358+ #endif /* end of OS_ENABLE_BLOCK_INSN_INTERRUPT */
2359+
23262360bool
23272361wasm_call_function (WASMExecEnv * exec_env , WASMFunctionInstance * function ,
23282362 unsigned argc , uint32 argv [])
@@ -2334,6 +2368,7 @@ wasm_call_function(WASMExecEnv *exec_env, WASMFunctionInstance *function,
23342368 wasm_exec_env_set_thread_info (exec_env );
23352369
23362370 interp_call_wasm (module_inst , exec_env , function , argc , argv );
2371+
23372372 return !wasm_get_exception (module_inst ) ? true : false;
23382373}
23392374
@@ -2345,7 +2380,7 @@ wasm_create_exec_env_and_call_function(WASMModuleInstance *module_inst,
23452380 WASMExecEnv * exec_env = NULL , * existing_exec_env = NULL ;
23462381 bool ret ;
23472382
2348- #if defined(OS_ENABLE_HW_BOUND_CHECK )
2383+ #if defined(OS_ENABLE_HW_BOUND_CHECK ) || defined( OS_ENABLE_BLOCK_INSN_INTERRUPT )
23492384 existing_exec_env = exec_env = wasm_runtime_get_exec_env_tls ();
23502385#elif WASM_ENABLE_THREAD_MGR != 0
23512386 existing_exec_env = exec_env =
0 commit comments