summary refs log tree commit diff stats
path: root/include/hw/core/cpu.h
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2025-01-21 12:12:35 +0100
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2025-03-09 17:00:47 +0100
commit30e76638eb35ffe88e95cca2b5af952c14dc336d (patch)
tree9a522a6d151abe32538b004dd99cba797739b5cd /include/hw/core/cpu.h
parent43610f3184f846da948e8ab9dbc0c5de1e9bde79 (diff)
downloadfocaccia-qemu-30e76638eb35ffe88e95cca2b5af952c14dc336d.tar.gz
focaccia-qemu-30e76638eb35ffe88e95cca2b5af952c14dc336d.zip
cpus: Prefer cached CpuClass over CPU_GET_CLASS() macro
CpuState caches its CPUClass since commit 6fbdff87062
("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>
Diffstat (limited to 'include/hw/core/cpu.h')
-rw-r--r--include/hw/core/cpu.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index bc0c946834..c6df426c94 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -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);
 }
 
 /**