From: Peter Maydell <peter.maydell@linaro.org>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Alexander Graf <agraf@suse.de>,
qemu-devel@nongnu.org, PowerPC <qemu-ppc@nongnu.org>,
pbonzini@redhat.com, aurelien@aurel32.net
Subject: Re: [Qemu-devel] [PATCH for-1.5?] target-ppc: Drop unnecessary dynamic cast in ppc_env_get_cpu()
Date: Fri, 10 May 2013 17:20:41 +0100 [thread overview]
Message-ID: <CAFEAcA8XvmGVz4moFD7d4Nxk_6p=zQNFru4wHRMQAH1Q1dZYrQ@mail.gmail.com> (raw)
In-Reply-To: <518D1CDD.4060705@suse.de>
On 10 May 2013 17:14, Andreas Färber <afaerber@suse.de> wrote:
> Personally I wouldn't oppose dropping these checks for release builds as
> proposed by Paolo in his series; for me, the value of POWERPC_CPU() is
> being closer to an OO cast than any container_of()-style expressions.
>
> But I can also see Anthony's point that we should try to optimize
> dynamic_cast rather than circumventing it.
I don't think we should be doing anything dynamically at all.
We know at compile time that we've been passed a CPUPPCState*,
and we know that we always get from that to a CPUState*
by subtracting a compile-time-constant offset. Nothing about
this is dynamic at all and anything we do at runtime beyond
that subtraction is pure overhead.
thanks
-- PMM
next prev parent reply other threads:[~2013-05-10 16:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-10 14:39 [Qemu-devel] [PATCH for-1.5?] target-ppc: Drop unnecessary dynamic cast in ppc_env_get_cpu() Andreas Färber
2013-05-10 14:42 ` Peter Maydell
2013-05-10 14:47 ` Andreas Färber
2013-05-10 15:07 ` Paolo Bonzini
2013-05-10 15:02 ` Anthony Liguori
2013-05-10 15:06 ` Anthony Liguori
2013-05-10 15:08 ` Paolo Bonzini
2013-05-10 15:54 ` Andreas Färber
[not found] ` <518D10E3.4080001@suse.de>
[not found] ` <14CF0363-E558-4387-A401-14C940131BDB@suse.de>
2013-05-10 16:14 ` Andreas Färber
2013-05-10 16:20 ` Peter Maydell [this message]
2013-05-10 16:40 ` 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='CAFEAcA8XvmGVz4moFD7d4Nxk_6p=zQNFru4wHRMQAH1Q1dZYrQ@mail.gmail.com' \
--to=peter.maydell@linaro.org \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=aurelien@aurel32.net \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).