mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-08 20:56:13 +00:00
clang-format
This commit is contained in:
parent
d0c6da10ff
commit
1f4d3dd4d4
|
@ -4105,14 +4105,17 @@ aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame)
|
||||||
|
|
||||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||||
void
|
void
|
||||||
aot_iterate_callstack(WASMExecEnv *exec_env, const wasm_frame_callback frame_handler, void* user_data)
|
aot_iterate_callstack(WASMExecEnv *exec_env,
|
||||||
|
const wasm_frame_callback frame_handler, void *user_data)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note for devs: please refrain from such modifications inside of aot_iterate_callstack
|
* Note for devs: please refrain from such modifications inside of
|
||||||
|
* aot_iterate_callstack
|
||||||
* - any allocations/freeing memory
|
* - any allocations/freeing memory
|
||||||
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
||||||
* exec_env->module_inst->module, pointers between stack's bottom and top_boundary
|
* exec_env->module_inst->module, pointers between stack's bottom and
|
||||||
* For more details check wasm_iterate_callstack in wasm_export.h
|
* top_boundary For more details check wasm_iterate_callstack in
|
||||||
|
* wasm_export.h
|
||||||
*/
|
*/
|
||||||
if (!is_tiny_frame(exec_env)) {
|
if (!is_tiny_frame(exec_env)) {
|
||||||
// TODO: support standard frames
|
// TODO: support standard frames
|
||||||
|
@ -4122,19 +4125,20 @@ aot_iterate_callstack(WASMExecEnv *exec_env, const wasm_frame_callback frame_han
|
||||||
uint8 *top = exec_env->wasm_stack.top;
|
uint8 *top = exec_env->wasm_stack.top;
|
||||||
uint8 *bottom = exec_env->wasm_stack.bottom;
|
uint8 *bottom = exec_env->wasm_stack.bottom;
|
||||||
|
|
||||||
bool is_top_index_in_range = top_boundary >= top && top >= (bottom + sizeof(AOTTinyFrame));
|
bool is_top_index_in_range =
|
||||||
|
top_boundary >= top && top >= (bottom + sizeof(AOTTinyFrame));
|
||||||
if (!is_top_index_in_range) {
|
if (!is_top_index_in_range) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool is_top_aligned_with_bottom = (unsigned long)(top - bottom) % sizeof(AOTTinyFrame) == 0;
|
bool is_top_aligned_with_bottom =
|
||||||
|
(unsigned long)(top - bottom) % sizeof(AOTTinyFrame) == 0;
|
||||||
if (!is_top_aligned_with_bottom) {
|
if (!is_top_aligned_with_bottom) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AOTTinyFrame *frame = (AOTTinyFrame *)(top - sizeof(AOTTinyFrame));
|
AOTTinyFrame *frame = (AOTTinyFrame *)(top - sizeof(AOTTinyFrame));
|
||||||
WASMCApiFrame record_frame;
|
WASMCApiFrame record_frame;
|
||||||
while (frame &&
|
while (frame && (uint8_t *)frame >= bottom) {
|
||||||
(uint8_t*)frame >= bottom) {
|
|
||||||
record_frame.instance = exec_env->module_inst;
|
record_frame.instance = exec_env->module_inst;
|
||||||
record_frame.module_offset = 0;
|
record_frame.module_offset = 0;
|
||||||
record_frame.func_index = frame->func_index;
|
record_frame.func_index = frame->func_index;
|
||||||
|
|
|
@ -778,7 +778,8 @@ bool
|
||||||
aot_create_call_stack(struct WASMExecEnv *exec_env);
|
aot_create_call_stack(struct WASMExecEnv *exec_env);
|
||||||
|
|
||||||
void
|
void
|
||||||
aot_iterate_callstack(WASMExecEnv *exec_env, const wasm_frame_callback frame_handler, void* user_data);
|
aot_iterate_callstack(WASMExecEnv *exec_env,
|
||||||
|
const wasm_frame_callback frame_handler, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Dump wasm call stack or get the size
|
* @brief Dump wasm call stack or get the size
|
||||||
|
|
|
@ -1742,17 +1742,22 @@ wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wasm_iterate_callstack(const wasm_exec_env_t exec_env, const wasm_frame_callback frame_callback, void* user_data)
|
wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||||
|
const wasm_frame_callback frame_callback,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note for devs: please refrain from such modifications inside of wasm_iterate_callstack
|
* Note for devs: please refrain from such modifications inside of
|
||||||
|
* wasm_iterate_callstack
|
||||||
* - any allocations/freeing memory
|
* - any allocations/freeing memory
|
||||||
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
||||||
* exec_env->module_inst->module, pointers between stack's bottom and top_boundary
|
* exec_env->module_inst->module, pointers between stack's bottom and
|
||||||
* For more details check wasm_iterate_callstack in wasm_export.h
|
* top_boundary For more details check wasm_iterate_callstack in
|
||||||
|
* wasm_export.h
|
||||||
*/
|
*/
|
||||||
#if WASM_ENABLE_DUMP_CALL_STACK
|
#if WASM_ENABLE_DUMP_CALL_STACK
|
||||||
WASMModuleInstance* module_inst = (WASMModuleInstance *)get_module_inst(exec_env);
|
WASMModuleInstance *module_inst =
|
||||||
|
(WASMModuleInstance *)get_module_inst(exec_env);
|
||||||
|
|
||||||
#if WASM_ENABLE_INTERP != 0
|
#if WASM_ENABLE_INTERP != 0
|
||||||
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
if (module_inst->module_type == Wasm_Module_Bytecode) {
|
||||||
|
|
|
@ -653,7 +653,9 @@ WASM_RUNTIME_API_EXTERN void
|
||||||
wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env);
|
wasm_runtime_destroy_exec_env(WASMExecEnv *exec_env);
|
||||||
|
|
||||||
WASM_RUNTIME_API_EXTERN void
|
WASM_RUNTIME_API_EXTERN void
|
||||||
wasm_iterate_callstack(const wasm_exec_env_t exec_env, const wasm_frame_callback frame_handler, void* user_data);
|
wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||||
|
const wasm_frame_callback frame_handler,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
/* See wasm_export.h for description */
|
/* See wasm_export.h for description */
|
||||||
WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
|
WASM_RUNTIME_API_EXTERN WASMModuleInstanceCommon *
|
||||||
|
|
|
@ -867,7 +867,6 @@ wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
|
||||||
WASM_RUNTIME_API_EXTERN void
|
WASM_RUNTIME_API_EXTERN void
|
||||||
wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
|
wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
|
||||||
|
|
||||||
|
|
||||||
typedef bool (*wasm_frame_callback)(void *, wasm_frame_ptr_t);
|
typedef bool (*wasm_frame_callback)(void *, wasm_frame_ptr_t);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -880,8 +879,8 @@ typedef bool (*wasm_frame_callback)(void*, wasm_frame_ptr_t);
|
||||||
* for wasm_frame_t from wasm_c_api.h
|
* for wasm_frame_t from wasm_c_api.h
|
||||||
*
|
*
|
||||||
* Note: The function is async-signal-safe if called with verified arguments.
|
* Note: The function is async-signal-safe if called with verified arguments.
|
||||||
* Meaning it's safe to call it from a signal handler even on a signal interruption
|
* Meaning it's safe to call it from a signal handler even on a signal
|
||||||
* from another thread if next variables hold valid pointers
|
* interruption from another thread if next variables hold valid pointers
|
||||||
* - exec_env
|
* - exec_env
|
||||||
* - exec_env->module_inst
|
* - exec_env->module_inst
|
||||||
* - exec_env->module_inst->module
|
* - exec_env->module_inst->module
|
||||||
|
@ -889,14 +888,16 @@ typedef bool (*wasm_frame_callback)(void*, wasm_frame_ptr_t);
|
||||||
* Note for devs: please refrain from such modifications inside of this call
|
* Note for devs: please refrain from such modifications inside of this call
|
||||||
* - any allocations/freeing memory
|
* - any allocations/freeing memory
|
||||||
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
||||||
* exec_env->module_inst->module, pointers between stack's bottom and top_boundary
|
* exec_env->module_inst->module, pointers between stack's bottom and
|
||||||
|
* top_boundary
|
||||||
*
|
*
|
||||||
* @param exec_env the execution environment that containes frames
|
* @param exec_env the execution environment that containes frames
|
||||||
* @param callback the callback function provided by the user
|
* @param callback the callback function provided by the user
|
||||||
* @param user_data context for callback provided by the user
|
* @param user_data context for callback provided by the user
|
||||||
*/
|
*/
|
||||||
WASM_RUNTIME_API_EXTERN void
|
WASM_RUNTIME_API_EXTERN void
|
||||||
wasm_iterate_callstack(const wasm_exec_env_t exec_env, const wasm_frame_callback callback, void *user_data);
|
wasm_iterate_callstack(const wasm_exec_env_t exec_env,
|
||||||
|
const wasm_frame_callback callback, void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the singleton execution environment for the instance.
|
* Get the singleton execution environment for the instance.
|
||||||
|
|
|
@ -4198,24 +4198,28 @@ wasm_get_module_inst_mem_consumption(const WASMModuleInstance *module_inst,
|
||||||
|
|
||||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||||
uint32
|
uint32
|
||||||
wasm_interp_iterate_callstack(WASMExecEnv *exec_env, const wasm_frame_callback frame_handler, void* user_data)
|
wasm_interp_iterate_callstack(WASMExecEnv *exec_env,
|
||||||
|
const wasm_frame_callback frame_handler,
|
||||||
|
void *user_data)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Note for devs: please refrain from such modifications inside of wasm_interp_iterate_callstack
|
* Note for devs: please refrain from such modifications inside of
|
||||||
|
* wasm_interp_iterate_callstack
|
||||||
* - any allocations/freeing memory
|
* - any allocations/freeing memory
|
||||||
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
* - dereferencing any pointers other than: exec_env, exec_env->module_inst,
|
||||||
* exec_env->module_inst->module, pointers between stack's bottom and top_boundary
|
* exec_env->module_inst->module, pointers between stack's bottom and
|
||||||
* For more details check wasm_iterate_callstack in wasm_export.h
|
* top_boundary For more details check wasm_iterate_callstack in
|
||||||
|
* wasm_export.h
|
||||||
*/
|
*/
|
||||||
WASMModuleInstance *module_inst = (WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env);
|
WASMModuleInstance *module_inst =
|
||||||
|
(WASMModuleInstance *)wasm_exec_env_get_module_inst(exec_env);
|
||||||
WASMInterpFrame *cur_frame = wasm_exec_env_get_cur_frame(exec_env);
|
WASMInterpFrame *cur_frame = wasm_exec_env_get_cur_frame(exec_env);
|
||||||
uint8 *top_boundary = exec_env->wasm_stack.top_boundary;
|
uint8 *top_boundary = exec_env->wasm_stack.top_boundary;
|
||||||
uint8 *bottom = exec_env->wasm_stack.bottom;
|
uint8 *bottom = exec_env->wasm_stack.bottom;
|
||||||
|
|
||||||
WASMCApiFrame record_frame;
|
WASMCApiFrame record_frame;
|
||||||
while (cur_frame &&
|
while (cur_frame && (uint8_t *)cur_frame >= bottom
|
||||||
(uint8_t*)cur_frame >= bottom &&
|
&& (uint8_t *)cur_frame + sizeof(WASMInterpFrame) <= top_boundary) {
|
||||||
(uint8_t*)cur_frame + sizeof(WASMInterpFrame) <= top_boundary) {
|
|
||||||
record_frame.instance = module_inst;
|
record_frame.instance = module_inst;
|
||||||
record_frame.module_offset = 0;
|
record_frame.module_offset = 0;
|
||||||
record_frame.func_index = cur_frame->func_index;
|
record_frame.func_index = cur_frame->func_index;
|
||||||
|
|
|
@ -732,7 +732,9 @@ wasm_get_table_inst(const WASMModuleInstance *module_inst, uint32 tbl_idx)
|
||||||
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
#if WASM_ENABLE_DUMP_CALL_STACK != 0
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
wasm_interp_iterate_callstack(WASMExecEnv *exec_env, const wasm_frame_callback frame_handler, void* user_data);
|
wasm_interp_iterate_callstack(WASMExecEnv *exec_env,
|
||||||
|
const wasm_frame_callback frame_handler,
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
bool
|
bool
|
||||||
wasm_interp_create_call_stack(struct WASMExecEnv *exec_env);
|
wasm_interp_create_call_stack(struct WASMExecEnv *exec_env);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user