From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NuTIC-0001m6-Hh for qemu-devel@nongnu.org; Wed, 24 Mar 2010 12:18:52 -0400 Received: from [140.186.70.92] (port=37844 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NuTI8-0001lP-MI for qemu-devel@nongnu.org; Wed, 24 Mar 2010 12:18:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NuTHy-0001eN-8n for qemu-devel@nongnu.org; Wed, 24 Mar 2010 12:18:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63398) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NuTHx-0001eD-Vs for qemu-devel@nongnu.org; Wed, 24 Mar 2010 12:18:38 -0400 Message-ID: <4BAA3B53.5030606@redhat.com> Date: Wed, 24 Mar 2010 17:18:27 +0100 From: Paolo Bonzini MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: Compile files only once: some planning References: <4BA9F52C.6070309@twiddle.net> <4BAA25A7.7000201@redhat.com> <201003241456.55779.paul@codesourcery.com> In-Reply-To: <201003241456.55779.paul@codesourcery.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: Blue Swirl , qemu-devel@nongnu.org, Richard Henderson On 03/24/2010 03:56 PM, Paul Brook wrote: >> On 03/24/2010 12:19 PM, Richard Henderson wrote: >>> On 03/24/2010 02:47 AM, Paolo Bonzini wrote: >>>> 1) make CPUState define only common fields. Include CPUState at the >>>> beginning of each per-target CPUXYZState. >>> >>> Irritatingly, the common fields contain quite big TLBs. And the >>> offsets from the start of env affect the compactness of the code >>> generated from TCG. We really really want the general registers >>> to come first to make sure that those offsets fit the host's >>> reg+offset addressing mode. >> >> What about adding a 512-bytes (or more) block or something like that at >> the beginning of CPUState with a union, so you can put the per-target >> stuff there? > > Is it really worth the hassle? Anything touching CPUState is probably going to > be CPU specific anyway. qemu-timer.c, hw/dma.c is not and these are the first two files I looked at. translate-all.c is the third, and it is except for a trivial cleanup. Big parts of vl.c are independent too. As a quick check: $ git grep -l 'CPUState' | grep -ve ^tcg -e ^target- | wc -l 96 $ git grep -l 'CPUState' | grep -ve ^tcg -e ^target- | \ xargs grep -l '#if.*TARGET_' | wc -l 36 The ones that remain are pretty much what would you expect, besides translate-all.c and some in hw/ which I snipped: bsd-user/main.c darwin-user/main.c darwin-user/qemu.h darwin-user/signal.c linux-user/elfload.c linux-user/main.c linux-user/qemu.h linux-user/signal.c linux-user/syscall.c cpu-all.h cpu-defs.h cpu-exec.c def-helper.h disas.c exec-all.h exec.c gdbstub.c monitor.c translate-all.c vl.c Of course this doesn't mean that 60 files are target-independent, but 30-ish probably are or can be made so. It would also help code clarity to use CPUXYZState more, to understand which hw/ files are specific to one model. For hw/s390-virtio.c that's obvious, but slightly less so for hw/sun4m.c and even less so for hw/syborg.c. This is an independent cleanup. Paolo