From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49043) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uapel-0001uS-D5 for qemu-devel@nongnu.org; Fri, 10 May 2013 11:54:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uapeg-0000oT-Gb for qemu-devel@nongnu.org; Fri, 10 May 2013 11:54:51 -0400 Message-ID: <518D1842.2040606@suse.de> Date: Fri, 10 May 2013 17:54:42 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1368196799-19982-1-git-send-email-afaerber@suse.de> <87obcizxgk.fsf@codemonkey.ws> In-Reply-To: <87obcizxgk.fsf@codemonkey.ws> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.5?] target-ppc: Drop unnecessary dynamic cast in ppc_env_get_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: pbonzini@redhat.com, PowerPC , qemu-devel@nongnu.org, aurelien@aurel32.net, Alexander Graf [resending after bounce] Am 10.05.2013 17:06, schrieb Anthony Liguori: > Andreas F=C3=A4rber writes: >=20 >> A transition from CPUPPCState to PowerPCCPU can be considered safe, >> just like PowerPCCPU::env access in the opposite direction. >> >> This should slightly improve interrupt performance. >> >> Reported-by: Anthony Liguori >> Signed-off-by: Andreas F=C3=A4rber >=20 > Another option would be to leave it and do something like: >=20 > diff --git a/qom/object.c b/qom/object.c > index 75e6aac..cba1d88 100644 > --- a/qom/object.c > +++ b/qom/object.c > @@ -126,8 +126,13 @@ static TypeImpl *type_register_internal(const Type= Info *info) > =20 > TypeImpl *type_register(const TypeInfo *info) > { > + TypeImpl *impl; > + > assert(info->parent); > - return type_register_internal(info); > + impl =3D type_register_internal(info); > + g_free(impl->name); > + impl->name =3D info->name; > + return impl; > } > =20 > TypeImpl *type_register_static(const TypeInfo *info) > @@ -449,10 +490,16 @@ Object *object_dynamic_cast_assert(Object *obj, c= onst char *typename) > ObjectClass *object_class_dynamic_cast(ObjectClass *class, > const char *typename) > { > - TypeImpl *target_type =3D type_get_by_name(typename); > + TypeImpl *target_type; > TypeImpl *type =3D class->type; > ObjectClass *ret =3D NULL; > =20 > + if (type->name =3D=3D typename) { > + return class; > + } > + > + target_type =3D type_get_by_name(typename); > + > if (!target_type) { > /* target class type unknown, so fail the cast */ > return NULL; >=20 > Which makes casting an object to it's concrete class free. Doesn't help here since concrete class is POWER7_v2.1-ppc64-cpu whereas we're casting to ppc64-cpu, with two-level hierarchy by now: POWER7_v2.1 -> POWER7 -> ppc64 -> device -> object. Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg