Rename meaningless @ret or @r variables as @excp to directly denote the value is an exception. No logical changes, purely cosmetic/clarity improvement.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- accel/tcg/cpu-exec.c | 24 ++++++++++++------------ accel/tcg/tcg-accel-ops-mttcg.c | 7 ++++--- accel/tcg/tcg-accel-ops-rr.c | 8 ++++---- accel/tcg/tcg-accel-ops.c | 7 ++++--- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 257211235db..53d90c400d5 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -687,7 +687,7 @@ static inline void cpu_handle_debug_exception(CPUState *cpu) } } -static inline bool cpu_handle_exception(CPUState *cpu, int *ret) +static inline bool cpu_handle_exception(CPUState *cpu, int *excp) { if (cpu->exception_index < 0) { #ifndef CONFIG_USER_ONLY @@ -703,8 +703,8 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) if (cpu->exception_index >= EXCP_INTERRUPT) { /* exit request from the cpu execution loop */ - *ret = cpu->exception_index; - if (*ret == EXCP_DEBUG) { + *excp = cpu->exception_index; + if (*excp == EXCP_DEBUG) { cpu_handle_debug_exception(cpu); } cpu->exception_index = -1; @@ -720,7 +720,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) if (tcg_ops->fake_user_interrupt) { tcg_ops->fake_user_interrupt(cpu); } - *ret = cpu->exception_index; + *excp = cpu->exception_index; cpu->exception_index = -1; return true; #else @@ -738,13 +738,13 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) * raised when single-stepping so that GDB doesn't miss the * next instruction. */ - *ret = EXCP_DEBUG; + *excp = EXCP_DEBUG; cpu_handle_debug_exception(cpu); return true; } } else if (!replay_has_interrupt()) { /* give a chance to iothread in replay mode */ - *ret = EXCP_INTERRUPT; + *excp = EXCP_INTERRUPT; return true; } #endif @@ -935,10 +935,10 @@ static inline void cpu_loop_exec_tb(CPUState *cpu, TranslationBlock *tb, static int __attribute__((noinline)) cpu_exec_loop(CPUState *cpu, SyncClocks *sc) { - int ret; + int excp; /* if an exception is pending, we execute it here */ - while (!cpu_handle_exception(cpu, &ret)) { + while (!cpu_handle_exception(cpu, &excp)) { TranslationBlock *last_tb = NULL; int tb_exit = 0; @@ -1006,7 +1006,7 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) align_clocks(sc, cpu); } } - return ret; + return excp; } static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) @@ -1021,7 +1021,7 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) int cpu_exec(CPUState *cpu) { - int ret; + int excp; SyncClocks sc = { 0 }; /* replay_interrupt may need current_cpu */ @@ -1042,10 +1042,10 @@ int cpu_exec(CPUState *cpu) */ init_delay_params(&sc, cpu); - ret = cpu_exec_setjmp(cpu, &sc); + excp = cpu_exec_setjmp(cpu, &sc); cpu_exec_exit(cpu); - return ret; + return excp; } bool tcg_exec_realizefn(CPUState *cpu, Error **errp) diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index 69560fdb9d8..e7edd1945f2 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -90,11 +90,12 @@ static void *mttcg_cpu_thread_fn(void *arg) qemu_process_cpu_events(cpu); if (cpu_can_run(cpu)) { - int r; + int excp; + bql_unlock(); - r = tcg_cpu_exec(cpu); + excp = tcg_cpu_exec(cpu); bql_lock(); - switch (r) { + switch (excp) { case EXCP_DEBUG: cpu_handle_guest_debug(cpu); break; diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c index cdaa3e11808..d6c2fc019c9 100644 --- a/accel/tcg/tcg-accel-ops-rr.c +++ b/accel/tcg/tcg-accel-ops-rr.c @@ -277,22 +277,22 @@ static void *rr_cpu_thread_fn(void *arg) (cpu->singlestep_flags & SSTEP_NOTIMER) == 0); if (cpu_can_run(cpu)) { - int r; + int excp; bql_unlock(); if (icount_enabled()) { icount_prepare_for_run(cpu, cpu_budget); } - r = tcg_cpu_exec(cpu); + excp = tcg_cpu_exec(cpu); if (icount_enabled()) { icount_process_data(cpu); } bql_lock(); - if (r == EXCP_DEBUG) { + if (excp == EXCP_DEBUG) { cpu_handle_guest_debug(cpu); break; - } else if (r == EXCP_ATOMIC) { + } else if (excp == EXCP_ATOMIC) { bql_unlock(); cpu_exec_step_atomic(cpu); bql_lock(); diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 560fe2554ba..9c3d2214162 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -77,13 +77,14 @@ void tcg_cpu_destroy(CPUState *cpu) int tcg_cpu_exec(CPUState *cpu) { - int ret; + int excp; + assert(tcg_enabled()); cpu_exec_start(cpu); - ret = cpu_exec(cpu); + excp = cpu_exec(cpu); cpu_exec_end(cpu); - return ret; + return excp; } static void tcg_cpu_reset_hold(CPUState *cpu) -- 2.53.0
