From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56697 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OTFDS-00034G-Lx for qemu-devel@nongnu.org; Mon, 28 Jun 2010 10:21:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OTFDR-0006e8-Iy for qemu-devel@nongnu.org; Mon, 28 Jun 2010 10:21:42 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:40720) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OTFDR-0006dt-E2 for qemu-devel@nongnu.org; Mon, 28 Jun 2010 10:21:41 -0400 Received: by pvg12 with SMTP id 12so2572424pvg.4 for ; Mon, 28 Jun 2010 07:21:40 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4C2857A5.20206@redhat.com> References: <1277470342-5861-1-git-send-email-pbonzini@redhat.com> <1277470342-5861-5-git-send-email-pbonzini@redhat.com> <4C2857A5.20206@redhat.com> From: Blue Swirl Date: Mon, 28 Jun 2010 14:21:20 +0000 Message-ID: Subject: Re: [Qemu-devel] [PATCH 4/7] provide opaque CPUState to files that are compiled once Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Amit Shah , Isaku Yamahata , qemu-devel@nongnu.org On Mon, Jun 28, 2010 at 8:04 AM, Paolo Bonzini wrote: > On 06/27/2010 09:17 PM, Blue Swirl wrote: >> >> I'm not comfortable with this part. Accidental use of the global >> register variable can cause subtle bugs. I'd rather rename 'env' to >> something more obvious and less likely to collide, like >> 'global_reg_env' and always poison that. Then we could replace 'env1' >> etc with just 'env'. > > This is not very different from before thanks to the reordering of includ= es > done in this patch. > > All target-*/exec.h files now start with > > #include "config.h" > #include "dyngen-exec.h" > #include "cpu.h" > #include "exec-all.h" > > // sometimes a few #defines > > register struct CPUAlphaState *env asm(AREG0); > > And so they cannot use the global env unless NEED_CPU_H is defined. =C2= =A0If > anything, it's clearer than before because the structure of the initial > #includes is the same for all targets. > > It's true that a "NEED_GLOBAL_ENV" would provide even better safety, but > that's something for a separate patch series. =C2=A0It's particularly eas= y to do > after replacing CPUState with CPUState, so that it can be moved i= nto > exec-all.h, but this series is already big enough IMO. =C2=A0Let's do cle= anups > one thing at a time please. Fine, but then let's not unpoison env with this patch set, please.