From: Paolo Bonzini <pbonzini@redhat.com>
To: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: aliguori@us.ibm.com, qemu-stable@nongnu.org,
qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches.
Date: Tue, 03 Dec 2013 16:40:46 +0100 [thread overview]
Message-ID: <529DFB7E.5040309@redhat.com> (raw)
In-Reply-To: <23ad4a5a9283ffcf4fc384832f369df46db18ef6.1385612379.git.peter.crosthwaite@xilinx.com>
Il 28/11/2013 05:27, Peter Crosthwaite ha scritto:
> The object-cast and class-cast caches cannot be shared because class
> caching is conditional on the target type not being an interface and
> object caching is unconditional. Leads to a bug when a class cast
> to an interface follows an object cast to the same interface type:
>
> FooObject = FOO(obj);
> FooClass = FOO_GET_CLASS(obj);
>
> Where TYPE_FOO is an interface. The first (object) cast will be
> successful and cache the casting result (i.e. TYPE_FOO will be cached).
> The second (class) cast will then check the shared cast cache
> and register a hit. The issue is, when a class cast hits in the cache
> it just returns a pointer cast of the input class (i.e. the concrete
> class).
>
> When casting to an interface, the cast itself must return the
> interface class, not the concrete class. The implementation of class
> cast caching already ensures that the returned cast result is only
> a pointer cast before caching. The object cast logic however does
> not have this check.
>
> Resolve by just splitting the object and class caches.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: qemu-stable@nongnu.org
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
next prev parent reply other threads:[~2013-12-03 15:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-28 4:27 [Qemu-devel] [PATCH qom v1 1/1] qom/object.c: Split out object and class caches Peter Crosthwaite
2013-12-03 15:40 ` Paolo Bonzini [this message]
2013-12-10 6:18 ` Peter Crosthwaite
2013-12-10 6:20 ` Nathan Rossi
2013-12-13 1:36 ` Edgar E. Iglesias
2013-12-15 20:09 ` Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=529DFB7E.5040309@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).