diff options
| author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-01-21 12:12:35 +0100 |
|---|---|---|
| committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2025-03-09 17:00:47 +0100 |
| commit | 30e76638eb35ffe88e95cca2b5af952c14dc336d (patch) | |
| tree | 9a522a6d151abe32538b004dd99cba797739b5cd /hw/core/cpu-common.c | |
| parent | 43610f3184f846da948e8ab9dbc0c5de1e9bde79 (diff) | |
| download | focaccia-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 'hw/core/cpu-common.c')
| -rw-r--r-- | hw/core/cpu-common.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c index 5671d8d4f5..ba0f02e49d 100644 --- a/hw/core/cpu-common.c +++ b/hw/core/cpu-common.c @@ -40,9 +40,7 @@ CPUState *cpu_by_arch_id(int64_t id) CPUState *cpu; CPU_FOREACH(cpu) { - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->get_arch_id(cpu) == id) { + if (cpu->cc->get_arch_id(cpu) == id) { return cpu; } } @@ -101,11 +99,9 @@ static int cpu_common_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg) void cpu_dump_state(CPUState *cpu, FILE *f, int flags) { - CPUClass *cc = CPU_GET_CLASS(cpu); - - if (cc->dump_state) { + if (cpu->cc->dump_state) { cpu_synchronize_state(cpu); - cc->dump_state(cpu, f, flags); + cpu->cc->dump_state(cpu, f, flags); } } @@ -119,11 +115,10 @@ void cpu_reset(CPUState *cpu) static void cpu_common_reset_hold(Object *obj, ResetType type) { CPUState *cpu = CPU(obj); - CPUClass *cc = CPU_GET_CLASS(cpu); if (qemu_loglevel_mask(CPU_LOG_RESET)) { qemu_log("CPU Reset (CPU %d)\n", cpu->cpu_index); - log_cpu_state(cpu, cc->reset_dump_flags); + log_cpu_state(cpu, cpu->cc->reset_dump_flags); } cpu->interrupt_request = 0; |