From 857e6b73c88ffb680764fbe019606200d7e35464 Mon Sep 17 00:00:00 2001 From: Georgii Rylov Date: Wed, 26 Feb 2025 10:57:50 +0000 Subject: [PATCH] formatting --- core/iwasm/aot/aot_runtime.h | 3 +-- core/iwasm/common/wasm_runtime_common.c | 3 +-- core/iwasm/common/wasm_runtime_common.h | 2 +- core/iwasm/include/wasm_export.h | 7 +++---- core/iwasm/interpreter/wasm_runtime.c | 23 +++++++++++------------ core/iwasm/interpreter/wasm_runtime.h | 2 +- 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/core/iwasm/aot/aot_runtime.h b/core/iwasm/aot/aot_runtime.h index 764403f72..a338cb4ef 100644 --- a/core/iwasm/aot/aot_runtime.h +++ b/core/iwasm/aot/aot_runtime.h @@ -780,8 +780,7 @@ aot_create_call_stack(struct WASMExecEnv *exec_env); #if WAMR_ENABLE_COPY_CALLSTACK != 0 uint32 aot_copy_callstack(WASMExecEnv *exec_env, wasm_frame_ptr_t buffer, - const uint32 length, - const uint32 skip_n); + const uint32 length, const uint32 skip_n); #endif // WAMR_ENABLE_COPY_CALLSTACK /** diff --git a/core/iwasm/common/wasm_runtime_common.c b/core/iwasm/common/wasm_runtime_common.c index a007c41f1..065bff1da 100644 --- a/core/iwasm/common/wasm_runtime_common.c +++ b/core/iwasm/common/wasm_runtime_common.c @@ -1743,8 +1743,7 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env) #if WAMR_ENABLE_COPY_CALLSTACK != 0 uint32 wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_ptr_t buffer, - const uint32 length, - const uint32 skip_n) + const uint32 length, const uint32 skip_n) { /* * Note for devs: please refrain from such modifications inside of diff --git a/core/iwasm/common/wasm_runtime_common.h b/core/iwasm/common/wasm_runtime_common.h index 44406cdb4..61b44aef6 100644 --- a/core/iwasm/common/wasm_runtime_common.h +++ b/core/iwasm/common/wasm_runtime_common.h @@ -642,7 +642,7 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env); #if WAMR_ENABLE_COPY_CALLSTACK != 0 WASM_RUNTIME_API_EXTERN uint32_t wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_ptr_t buffer, - const uint32 length, const uint32 skip_n); + const uint32 length, const uint32 skip_n); #endif // WAMR_ENABLE_COPY_CALLSTACK /* See wasm_export.h for description */ diff --git a/core/iwasm/include/wasm_export.h b/core/iwasm/include/wasm_export.h index a17f13f24..cacc68e2a 100644 --- a/core/iwasm/include/wasm_export.h +++ b/core/iwasm/include/wasm_export.h @@ -126,7 +126,6 @@ typedef WASMFunctionInstanceCommon *wasm_function_inst_t; struct WASMMemoryInstance; typedef struct WASMMemoryInstance *wasm_memory_inst_t; - typedef struct wasm_frame_t { /* wasm_instance_t */ void *instance; @@ -880,7 +879,6 @@ wasm_runtime_create_exec_env(wasm_module_inst_t module_inst, WASM_RUNTIME_API_EXTERN void wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env); - /** * @brief Copy callstack frames. * @@ -898,7 +896,8 @@ wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env); * - exec_env->module_inst->module * * @param exec_env the execution environment that containes frames - * @param buffer the buffer of size equal length * sizeof(frame) to copy frames to + * @param buffer the buffer of size equal length * sizeof(frame) to copy frames + * to * @param length the number of frames to copy * @param skip_n the number of frames to skip from the top of the stack * @@ -906,7 +905,7 @@ wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env); */ WASM_RUNTIME_API_EXTERN uint32_t wasm_copy_callstack(const wasm_exec_env_t exec_env, wasm_frame_ptr_t buffer, - const uint32_t length, const uint32_t skip_n); + const uint32_t length, const uint32_t skip_n); /** * Get the singleton execution environment for the instance. diff --git a/core/iwasm/interpreter/wasm_runtime.c b/core/iwasm/interpreter/wasm_runtime.c index 9431b0bed..0f75eb9f9 100644 --- a/core/iwasm/interpreter/wasm_runtime.c +++ b/core/iwasm/interpreter/wasm_runtime.c @@ -4196,21 +4196,20 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst, #endif /* end of (WASM_ENABLE_MEMORY_PROFILING != 0) \ || (WASM_ENABLE_MEMORY_TRACING != 0) */ - #if WAMR_ENABLE_COPY_CALLSTACK != 0 uint32 wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_ptr_t buffer, - uint32 length, uint32 skip_n) + uint32 length, uint32 skip_n) { /* - * Note for devs: please refrain from such modifications inside of - * wasm_interp_copy_callstack - * - any allocations/freeing memory - * - dereferencing any pointers other than: exec_env, exec_env->module_inst, - * exec_env->module_inst->module, pointers between stack's bottom and - * top_boundary For more details check wasm_copy_callstack in - * wasm_export.h - */ + * Note for devs: please refrain from such modifications inside of + * wasm_interp_copy_callstack + * - any allocations/freeing memory + * - dereferencing any pointers other than: exec_env, exec_env->module_inst, + * exec_env->module_inst->module, pointers between stack's bottom and + * top_boundary For more details check wasm_copy_callstack in + * wasm_export.h + */ WASMModuleInstance *module_inst = (WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env); WASMInterpFrame *cur_frame = wasm_exec_env_get_cur_frame(exec_env); @@ -4221,8 +4220,8 @@ wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_ptr_t buffer, WASMCApiFrame record_frame; while (cur_frame && (uint8_t *)cur_frame >= bottom - && (uint8_t *)cur_frame + sizeof(WASMInterpFrame) <= top_boundary - && count < (skip_n + length)) { + && (uint8_t *)cur_frame + sizeof(WASMInterpFrame) <= top_boundary + && count < (skip_n + length)) { if (!cur_frame->function) { cur_frame = cur_frame->prev_frame; continue; diff --git a/core/iwasm/interpreter/wasm_runtime.h b/core/iwasm/interpreter/wasm_runtime.h index 1cdce10ed..3747eb80f 100644 --- a/core/iwasm/interpreter/wasm_runtime.h +++ b/core/iwasm/interpreter/wasm_runtime.h @@ -734,7 +734,7 @@ wasm_get_table_inst(const WASMModuleInstance *module_inst, uint32 tbl_idx) #if WAMR_ENABLE_COPY_CALLSTACK != 0 uint32 wasm_interp_copy_callstack(WASMExecEnv *exec_env, wasm_frame_ptr_t buffer, - uint32 length, uint32 skip_n); + uint32 length, uint32 skip_n); #endif // WAMR_ENABLE_COPY_CALLSTACK bool