mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-06-18 02:59:21 +00:00
fix: improve instruction limit checks and enhance readability of HANDLE_OP macros
This commit is contained in:
parent
e4ceb6b429
commit
70af781bde
|
@ -1569,11 +1569,13 @@ get_global_addr(uint8 *global_data, WASMGlobalInstance *global)
|
|||
}
|
||||
|
||||
#if WASM_INSTRUCTION_METERING != 0
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
goto return_func; \
|
||||
} \
|
||||
instructions_left--;
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
wasm_set_exception(module, "instruction limit exceeded"); \
|
||||
goto got_exception; \
|
||||
} \
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -102,11 +102,14 @@ typedef float64 CellType_F64;
|
|||
} while (0)
|
||||
|
||||
#if WASM_INSTRUCTION_METERING != 0
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
goto return_func; \
|
||||
} \
|
||||
instructions_left--;
|
||||
#define CHECK_INSTRUCTION_LIMIT() \
|
||||
if (instructions_left == 0) { \
|
||||
wasm_set_exception(module_inst, "instruction limit exceeded"); \
|
||||
goto got_exception; \
|
||||
} \
|
||||
else if (instructions_left > 0) { \
|
||||
instructions_left--; \
|
||||
} \
|
||||
#else
|
||||
#define CHECK_INSTRUCTION_LIMIT() (void)0
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user