cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro

CpuState caches its CPUClass since commit 6fbdff8706
("cpu: cache CPUClass in CPUState for hot code paths"),
use it.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20250122093028.52416-5-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé 2025-01-21 12:12:35 +01:00
parent 43610f3184
commit 30e76638eb
4 changed files with 33 additions and 61 deletions

View file

@ -826,10 +826,8 @@ const char *parse_cpu_option(const char *cpu_option);
*/
static inline bool cpu_has_work(CPUState *cpu)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
g_assert(cc->has_work);
return cc->has_work(cpu);
g_assert(cpu->cc->has_work);
return cpu->cc->has_work(cpu);
}
/**
@ -968,9 +966,7 @@ void cpu_interrupt(CPUState *cpu, int mask);
*/
static inline void cpu_set_pc(CPUState *cpu, vaddr addr)
{
CPUClass *cc = CPU_GET_CLASS(cpu);
cc->set_pc(cpu, addr);
cpu->cc->set_pc(cpu, addr);
}
/**