From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpjDe-0004Ri-U8 for qemu-devel@nongnu.org; Fri, 23 Oct 2015 16:45:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpjDb-0000fq-Cl for qemu-devel@nongnu.org; Fri, 23 Oct 2015 16:45:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpjDa-0000fQ-NO for qemu-devel@nongnu.org; Fri, 23 Oct 2015 16:45:42 -0400 References: <1445576998-2921-1-git-send-email-eblake@redhat.com> <1445576998-2921-11-git-send-email-eblake@redhat.com> <87oafp8kjl.fsf@blackfin.pond.sub.org> <562A882F.4080407@redhat.com> From: Eric Blake Message-ID: <562A9C75.9070501@redhat.com> Date: Fri, 23 Oct 2015 14:45:41 -0600 MIME-Version: 1.0 In-Reply-To: <562A882F.4080407@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4bO51qbwFXUOjS0GoS671nV6j99eC4vLG" Subject: Re: [Qemu-devel] [PATCH v10 10/25] qapi: Unbox base members List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, Michael Roth , Gerd Hoffmann , Luiz Capitulino This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --4bO51qbwFXUOjS0GoS671nV6j99eC4vLG Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/23/2015 01:19 PM, Eric Blake wrote: > On 10/23/2015 01:14 PM, Markus Armbruster wrote: >> Eric Blake writes: >> >>> Rather than storing a base class as a pointer to a box, just >>> store the fields of that base class in the same order, so that >>> a child struct can be directly cast to its parent. This gives >>> less malloc overhead, less pointer dereferencing, and even less >>> generated code. Compare to the earlier commit 1e6c1616a "qapi: >>> Generate a nicer struct for flat unions" (although that patch >>> had fewer places to change, as less of qemu was directly using >>> qapi structs for flat unions). It also drops a hack that was >>> needed for type-safe casting to the base class of a struct. >>> >>> Changes to the generated code look like this in qapi-types.h: >>> >=20 >>> >>> as well as: >>> >>> | static inline SpiceBasicInfo *qapi_SpiceChannel_base(const SpiceCha= nnel *obj) >>> | { >>> |- return (SpiceBasicInfo *)obj->base; >>> |+ return (SpiceBasicInfo *)obj; >>> | } >> >> No more, PATCH 09 hides this change. If you limit that one to just >> unions, it'll be visible again here, but it'll look different. >=20 > No, this change is new to v10, because of patch 09. In v9, we did not > have gen_upcast(); in v10, patch 9's version of gen_upcast() had to > special-case struct to output 'obj->base', and patch 10 gets rid of the= > special case to output 'obj' always. Serves me right for reading this response before the 9/25 response. I see what you mean now, and will be floating hunks differently on the v11 respin. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --4bO51qbwFXUOjS0GoS671nV6j99eC4vLG Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWKpx1AAoJEKeha0olJ0NqPmQH/A4l/tug3gjIBJnpMHa1bRRV 8Mg4uqk49qV4xXPcQ+bkVYNLqqF1S2/DaZnqZCWvqWxIx1fRKxIanSZYvvZBDqaZ 0qGkhTyXlcpfEt/fTxMMToeW1rtHwI0O+M3MnRgt0kIJVZHJXdgYkcXIRGHCEOTg pnPhTut1R0B+oJcxHTtIGInAqzvPnn400kz83xLRpV6NPt/nuvHIXYsYoCXwBs85 9UbEcCIxDyukF56Fjxt2sfElxXqfEhAHEOYT9Egkvd9DzMOFF3YMwOlLLyfkP0aF BlJaeLf4vsbwTi0nyM1gCauKzfBw4yTZhyPzKNDAOznyJzZzskcClaaUDp3FPwQ= =mzuu -----END PGP SIGNATURE----- --4bO51qbwFXUOjS0GoS671nV6j99eC4vLG--