qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 28/35] qapi: Eliminate empty visit_type_FOO_f


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v8 28/35] qapi: Eliminate empty visit_type_FOO_fields
Date: Tue, 5 Jan 2016 15:04:12 +0100

Hi

On Mon, Dec 21, 2015 at 6:08 PM, Eric Blake <address@hidden> wrote:
> For empty structs, such as the 'Abort' helper type used as part
> of the 'transaction' command, we were emitting a no-op
> visit_type_FOO_fields().  Optimize things to instead omit calls
> for empty structs.  Generated code changes resemble:
>
> |-static void visit_type_Abort_fields(Visitor *v, Abort **obj, Error **errp)
> |-{
> |-    Error *err = NULL;
> |-
> |-    error_propagate(errp, err);
> |-}
> |-
> | void visit_type_Abort(Visitor *v, const char *name, Abort **obj, Error 
> **errp)
> | {
> |     Error *err = NULL;
> |@@ -112,7 +105,6 @@ void visit_type_Abort(Visitor *v, Abort
> |     if (!*obj) {
> |         goto out_obj;
> |     }
> |-    visit_type_Abort_fields(v, obj, &err);
> | out_obj:
> |     error_propagate(errp, err);
>
> Another reason for doing this optimization is that it gets us
> closer to merging the code for visiting structs and unions:
> since flat unions have no local members, they do not need to
> have a visit_type_UNION_fields() emitted, even when they start
> sharing the code used to visit structs.
>
> Signed-off-by: Eric Blake <address@hidden>
>

Reviewed-by: Marc-André Lureau <address@hidden>




-- 
Marc-André Lureau



reply via email to

[Prev in Thread] Current Thread [Next in Thread]