Of the 5 calls in our codebase, 4 are unlikely(), so not worth inlining in header. Since the CPUState is simply read-only accessed, make the argument const.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- include/exec/cpu-common.h | 6 +----- accel/tcg/cpu-exec-common.c | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 3757ab15967..664e21e0b6c 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -62,7 +62,6 @@ void cpu_destroy_address_spaces(CPUState *cpu); void list_cpus(void); #ifdef CONFIG_TCG -#include "qemu/atomic.h" /** * cpu_loop_exit_requested: @@ -76,10 +75,7 @@ void list_cpus(void); * call can be used to check if it makes sense to return to the main loop * or to continue executing the interruptible instruction. */ -static inline bool cpu_loop_exit_requested(CPUState *cpu) -{ - return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0; -} +bool cpu_loop_exit_requested(const CPUState *cpu); G_NORETURN void cpu_loop_exit_noexc(CPUState *cpu); G_NORETURN void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index c5c513f1e4a..b571488be9e 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "exec/log.h" #include "system/tcg.h" +#include "qemu/atomic.h" #include "qemu/plugin.h" #include "internal-common.h" @@ -88,3 +89,8 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc) cpu->exception_index = EXCP_ATOMIC; cpu_loop_exit_restore(cpu, pc); } + +bool cpu_loop_exit_requested(const CPUState *cpu) +{ + return (int32_t)qatomic_read(&cpu->neg.icount_decr.u32) < 0; +} -- 2.53.0
