On 10/23/2015 01:19 PM, Eric Blake wrote:
> On 10/23/2015 01:14 PM, Markus Armbruster wrote:
>> Eric Blake <ebl...@redhat.com> 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:
>>>
> 
>>>
>>> as well as:
>>>
>>> | static inline SpiceBasicInfo *qapi_SpiceChannel_base(const SpiceChannel 
>>> *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.
> 
> 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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to