[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: Andreas Färber
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 18:40:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Am 10.05.2013 18:20, schrieb Peter Maydell:
> 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.

No one doubts that for CPU.

But if you think of AXI, I2C and the general connecter inheritance vs.
aggregation discussion, it becomes much more hairy! In particular
Anthony's solution to the I/O port VGA vs. ISA problem was dropping
ISADevice as base type and turning ISA into an interface on a chipset
object. Then you may know which interfaces are available on your device,
but you still need some special non-C cast, aka dynamic_cast.

So in the end we want C++ (replace with favorite native OO language) but
we can't switch because not all devices are QOM'ified yet, and when
QOM'ifying them we get complaints about bad QOM performance.
Either we ignore performance hits and hurry up with the conversion or we
address performance hits to at least some degree, otherwise we're not
going to reach a satisfactory solution...


SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

reply via email to

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