From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTUcs-00081U-Pq for qemu-devel@nongnu.org; Wed, 10 Feb 2016 08:16:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTUcr-0003hC-SQ for qemu-devel@nongnu.org; Wed, 10 Feb 2016 08:16:10 -0500 From: =?utf-8?Q?Llu=C3=ADs_Vilanova?= References: <145505246212.4785.2237668256809452874.stgit@localhost> <145505248083.4785.7066950318146523490.stgit@localhost> <56BAAD86.3010007@twiddle.net> Date: Wed, 10 Feb 2016 14:15:24 +0100 In-Reply-To: <56BAAD86.3010007@twiddle.net> (Richard Henderson's message of "Wed, 10 Feb 2016 14:24:54 +1100") Message-ID: <87d1s4emfn.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v6 3/4] tcg: Add type for vCPU pointers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: Peter Maydell , Eduardo Habkost , Paolo Bonzini , Stefan Hajnoczi , Anthony Green , Mark Cave-Ayland , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , Max Filippov , Michael Walle , "open list:ARM" , "open list:PowerPC" , Leon Alrae , Bastian Koppelmann , "Edgar E. Iglesias" , Guan Xuetao , Alex =?utf-8?Q?Benn=C3=A9e?= , Aurelien Jarno , Jia Liu Richard Henderson writes: > On 02/10/2016 08:14 AM, Llu=C3=ADs Vilanova wrote: >> Adds the 'TCGv_env' type for pointers to 'CPUArchState' objects. The >> tracing infrastructure later needs to differentiate between regular >> pointers and pointers to vCPUs. >>=20 >> Also changes all targets to use the new 'TCGv_cpu' type instead of the >> generic 'TCGv_ptr'. As of now, the change is merely cosmetic ('TCGv_env' >> translates into 'TCGv_ptr'), but that could change in the future to >> enforce the difference. > I suppose. > We won't be able distinguish TCGv_env from TCGv_ptr until env can be > auto-converted to ptr. Which I can't imagine happening without switching= to > C++. It's difficult to differenciate between TCGv_ptr and TCGv_env in "tcg/tcg-o= p.h" unless an explicit operation is added to perform casts or to get a TCGv_ptr= from a TCGv_env+offset (e.g., add a tcg_gen_env_ld8u_i32 built on top of tcg_gen_ld8u_i32). That is, unless QEMU switches to C++. But types could be easily enforced in helper declarations, which can intern= ally cast to the pointer type. As a side note, I've just spotted a typo in the commit message (TCGv_cpu -> TCGv_env). > I see your motivation in 4/4, so I guess this is fine. > Acked-by: Richard Henderson Thanks, Lluis