From 8c262ba00562ddb10444b70cda9b33bd6c9b16de Mon Sep 17 00:00:00 2001 From: Alix ANNERAUD Date: Sun, 2 Mar 2025 19:48:06 +0100 Subject: [PATCH] fix: formatting --- core/config.h | 2 +- core/iwasm/common/wasm_runtime_common.c | 5 ++- core/iwasm/include/wasm_export.h | 5 +-- core/iwasm/interpreter/wasm_interp_classic.c | 42 +++++++++++--------- core/iwasm/interpreter/wasm_interp_fast.c | 10 ++--- 5 files changed, 35 insertions(+), 29 deletions(-) diff --git a/core/config.h b/core/config.h index c301aa074..19fed6812 100644 --- a/core/config.h +++ b/core/config.h @@ -710,7 +710,7 @@ #define WASM_ENABLE_AOT_VALIDATOR 0 #endif -#ifndef WASM_INSTRUCTION_METERING +#ifndef WASM_INSTRUCTION_METERING #define WASM_INSTRUCTION_METERING 1 #endif diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index 9ec8f138b..2f58d82ef 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -2286,8 +2286,9 @@ wasm_runtime_access_exce_check_guard_page() #endif #ifdef WASM_INSTRUCTION_METERING -void wasm_runtime_set_instructions_to_execute(WASMExecEnv *exec_env, - int instructions_to_execute) +void +wasm_runtime_set_instructions_to_execute(WASMExecEnv *exec_env, + int instructions_to_execute) { exec_env->instructions_to_execute = instructions_to_execute; } diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index 3324ebd19..b4ab34bea 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -1827,14 +1827,13 @@ wasm_runtime_set_native_stack_boundary(wasm_exec_env_t exec_env, * However, if the instruction count limit is set to a positive value, * the execution will be terminated when the instruction count reaches * the limit. - * + * * @param exec_env the execution environment * @param instruction_count the instruction count limit */ WASM_RUNTIME_API_EXTERN void wasm_runtime_set_instruction_count_limit(wasm_exec_env_t exec_env, - int instruction_count); - + int instruction_count); /** * Dump runtime memory consumption, including: diff --git a/core/iwasm/interpreter/wasm_interp_classic.c b/core/iwasm/interpreter/wasm_interp_classic.c index 3b0cc83a3..6463e382b 100644 --- a/core/iwasm/interpreter/wasm_interp_classic.c +++ b/core/iwasm/interpreter/wasm_interp_classic.c @@ -1516,13 +1516,13 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst, } \ os_mutex_unlock(&exec_env->wait_lock); \ } \ - CHECK_INSTRUCTION_LIMIT(); \ \ - goto *handle_table[*frame_ip++]; \ + CHECK_INSTRUCTION_LIMIT(); \ + \ goto *handle_table[*frame_ip++]; \ } while (0) #else -#define HANDLE_OP_END() \ - CHECK_INSTRUCTION_LIMIT(); \ - FETCH_OPCODE_AND_DISPATCH() +#define HANDLE_OP_END() \ + CHECK_INSTRUCTION_LIMIT(); \ + FETCH_OPCODE_AND_DISPATCH() #endif #else /* else of WASM_ENABLE_LABELS_AS_VALUES */ @@ -1545,12 +1545,12 @@ wasm_interp_call_func_import(WASMModuleInstance *module_inst, } \ os_mutex_unlock(&exec_env->wait_lock); \ } \ - CHECK_INSTRUCTION_LIMIT(); \ + CHECK_INSTRUCTION_LIMIT(); \ continue; #else -#define HANDLE_OP_END() - CHECK_INSTRUCTION_LIMIT(); \ - continue; +#define HANDLE_OP_END() +CHECK_INSTRUCTION_LIMIT(); +continue; #endif #endif /* end of WASM_ENABLE_LABELS_AS_VALUES */ @@ -1569,11 +1569,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; \ - } \ - instructions_left--; +#define CHECK_INSTRUCTION_LIMIT() \ + if (instructions_left == 0) { \ + goto return_func; \ + } \ + instructions_left--; #else #define CHECK_INSTRUCTION_LIMIT() (void)0 #endif @@ -1621,7 +1621,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, uint32 local_idx, local_offset, global_idx; uint8 local_type, *global_addr; uint32 cache_index, type_index, param_cell_num, cell_num; - + #if WASM_INSTRUCTION_METERING != 0 int instructions_left = exec_env->instructions_to_execute; #endif @@ -1718,7 +1718,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) @@ -2455,7 +2458,7 @@ wasm_interp_call_func_bytecode(WASMModuleInstance *module, else cur_func_type = cur_func->u.func->func_type; - /* clang-format off */ + /* clang-format off */ #if WASM_ENABLE_GC == 0 if (cur_type != cur_func_type) { wasm_set_exception(module, "indirect call type mismatch"); @@ -5655,7 +5658,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) { diff --git a/core/iwasm/interpreter/wasm_interp_fast.c b/core/iwasm/interpreter/wasm_interp_fast.c index ffd370a33..7b9f181d1 100644 --- a/core/iwasm/interpreter/wasm_interp_fast.c +++ b/core/iwasm/interpreter/wasm_interp_fast.c @@ -102,11 +102,11 @@ 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) { \ + goto return_func; \ + } \ + instructions_left--; #else #define CHECK_INSTRUCTION_LIMIT() (void)0 #endif