Paolo Bonzini <pbonz...@redhat.com> writes: > Access everything from the class. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > qom/object.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/qom/object.c b/qom/object.c > index f5f416b..f82f12c 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -457,15 +457,13 @@ ObjectClass *object_class_dynamic_cast(ObjectClass > *class, > { > ObjectClass *ret = NULL; > TypeImpl *target_type; > - TypeImpl *type; > > if (!class) { > return NULL; > } > > /* A simple fast path that can trigger a lot for leaf classes. */ > - type = class->type; > - if (type->name == typename) { > + if (class->type->name == typename) {
This won't trigger because we unconditionally strdup(). Can you add this the bit from my patch that sets ->name appropriately? Aurelien, can you try the resulting series with --{enable,disable}-qom-casts? My suspicion is that this is the primary source of speed up. If you can make an image available too, I can try this myself. Regards, Anthony Liguori > return class; > } > > @@ -475,7 +473,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class, > return NULL; > } > > - if (type->class->interfaces && > + if (class->interfaces && > type_is_ancestor(target_type, type_interface)) { > int found = 0; > GSList *i; > @@ -493,7 +491,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class, > if (found > 1) { > ret = NULL; > } > - } else if (type_is_ancestor(type, target_type)) { > + } else if (type_is_ancestor(class->type, target_type)) { > ret = class; > } > > -- > 1.8.1.4