|
From: | Richard Henderson |
Subject: | Re: [PATCH 4/4] hw/cpu: Call object_class_dynamic_cast() once in cpu_class_by_name() |
Date: | Sat, 9 Sep 2023 16:26:18 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 |
On 9/8/23 04:22, Philippe Mathieu-Daudé wrote:
+++ b/hw/core/cpu-common.c @@ -157,7 +157,8 @@ ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model) cc = CPU_CLASS(oc); assert(cc->cpu_resolving_type && cc->class_by_name); oc = cc->class_by_name(cpu_model); - if (oc == NULL || object_class_is_abstract(oc)) { + if (oc == NULL || object_class_is_abstract(oc) + || !object_class_dynamic_cast(oc, cc->cpu_resolving_type)) { return NULL; }
cc->cpu_resolving_type, as constructed in patch 3, is always @typename. In the only (!) caller in toplevel/cpu.c, this is CPU_RESOLVING_TYPE. Indentation: if (oc == NULL || object_class_is_abstract(oc) || !object_class_dynamic_cast(oc, typename) r~
[Prev in Thread] | Current Thread | [Next in Thread] |