Skip to content

Commit 65521b1

Browse files
authored
Remove unnecessary code duplication in aot runtime (#3767)
1 parent fed0fe9 commit 65521b1

File tree

1 file changed

+3
-28
lines changed

1 file changed

+3
-28
lines changed

core/iwasm/aot/aot_runtime.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3668,33 +3668,6 @@ aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index)
36683668
return true;
36693669
}
36703670

3671-
static inline void
3672-
aot_free_frame_internal(WASMExecEnv *exec_env)
3673-
{
3674-
AOTFrame *cur_frame = (AOTFrame *)exec_env->cur_frame;
3675-
AOTFrame *prev_frame = cur_frame->prev_frame;
3676-
3677-
#if WASM_ENABLE_PERF_PROFILING != 0
3678-
uint64 time_elapsed =
3679-
(uintptr_t)os_time_thread_cputime_us() - cur_frame->time_started;
3680-
3681-
cur_frame->func_perf_prof_info->total_exec_time += time_elapsed;
3682-
cur_frame->func_perf_prof_info->total_exec_cnt++;
3683-
3684-
/* parent function */
3685-
if (prev_frame)
3686-
prev_frame->func_perf_prof_info->children_exec_time += time_elapsed;
3687-
#endif
3688-
3689-
exec_env->cur_frame = (struct WASMInterpFrame *)prev_frame;
3690-
}
3691-
3692-
void
3693-
aot_free_frame(WASMExecEnv *exec_env)
3694-
{
3695-
aot_free_frame_internal(exec_env);
3696-
}
3697-
36983671
#else /* else of WASM_ENABLE_GC == 0 */
36993672

37003673
bool
@@ -3752,6 +3725,7 @@ aot_alloc_frame(WASMExecEnv *exec_env, uint32 func_index)
37523725
frame->func_index = func_index;
37533726
return true;
37543727
}
3728+
#endif /* end of WASM_ENABLE_GC == 0 */
37553729

37563730
static inline void
37573731
aot_free_frame_internal(WASMExecEnv *exec_env)
@@ -3771,7 +3745,9 @@ aot_free_frame_internal(WASMExecEnv *exec_env)
37713745
prev_frame->func_perf_prof_info->children_exec_time += time_elapsed;
37723746
#endif
37733747

3748+
#if WASM_ENABLE_GC != 0
37743749
wasm_exec_env_free_wasm_frame(exec_env, cur_frame);
3750+
#endif
37753751
exec_env->cur_frame = (struct WASMInterpFrame *)prev_frame;
37763752
}
37773753

@@ -3781,7 +3757,6 @@ aot_free_frame(WASMExecEnv *exec_env)
37813757
aot_free_frame_internal(exec_env);
37823758
}
37833759

3784-
#endif /* end of WASM_ENABLE_GC == 0 */
37853760

37863761
void
37873762
aot_frame_update_profile_info(WASMExecEnv *exec_env, bool alloc_frame)

0 commit comments

Comments
 (0)