[Top][All Lists]

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

Re: [Qemu-ppc] [Qemu-devel] [PATCH for-1.5?] target-ppc: Drop unnecessar

From: Peter Maydell
Subject: Re: [Qemu-ppc] [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

On 10 May 2013 17:14, Andreas Färber <address@hidden> 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.

-- PMM

reply via email to

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