mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-12-09 07:43:54 +00:00
fix: improve instruction limit checks and enhance readability of HANDLE_OP macros
This commit is contained in:
parent
e4ceb6b429
commit
70af781bde
|
|
@ -1571,9 +1571,11 @@ get_global_addr(uint8 *global_data, WASMGlobalInstance *global)
|
|||
#if WASM_INSTRUCTION_METERING != 0
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
goto return_func; \
|
||||
wasm_set_exception(module, "instruction limit exceeded"); \
|
||||
goto got_exception; \
|
||||
} \
|
||||
instructions_left--;
|
||||
else if (instructions_left > 0) \
|
||||
instructions_left--; \
|
||||
#else
|
||||
#define CHECK_INSTRUCTION_LIMIT() (void)0
|
||||
#endif
|
||||
|
|
@ -1721,7 +1723,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
goto got_exception;
|
||||
}
|
||||
|
||||
HANDLE_OP(WASM_OP_NOP) { HANDLE_OP_END(); }
|
||||
HANDLE_OP(WASM_OP_NOP)
|
||||
{
|
||||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
#if WASM_ENABLE_EXCE_HANDLING != 0
|
||||
HANDLE_OP(WASM_OP_RETHROW)
|
||||
|
|
@ -5658,7 +5663,10 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module,
|
|||
HANDLE_OP(WASM_OP_I32_REINTERPRET_F32)
|
||||
HANDLE_OP(WASM_OP_I64_REINTERPRET_F64)
|
||||
HANDLE_OP(WASM_OP_F32_REINTERPRET_I32)
|
||||
HANDLE_OP(WASM_OP_F64_REINTERPRET_I64) { HANDLE_OP_END(); }
|
||||
HANDLE_OP(WASM_OP_F64_REINTERPRET_I64)
|
||||
{
|
||||
HANDLE_OP_END();
|
||||
}
|
||||
|
||||
HANDLE_OP(WASM_OP_I32_EXTEND8_S)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -104,9 +104,12 @@ typedef float64 CellType_F64;
|
|||
#if WASM_INSTRUCTION_METERING != 0
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
goto return_func; \
|
||||
wasm_set_exception(module_inst, "instruction limit exceeded"); \
|
||||
goto got_exception; \
|
||||
} \
|
||||
else if (instructions_left > 0) { \
|
||||
instructions_left--; \
|
||||
} \
|
||||
instructions_left--;
|
||||
#else
|
||||
#define CHECK_INSTRUCTION_LIMIT() (void)0
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user