From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSWMV-0007GE-96 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 18:32:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSWMR-0002No-C4 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 18:32:03 -0400 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:33968) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSWMR-0002NU-6X for qemu-devel@nongnu.org; Tue, 04 Jul 2017 18:31:59 -0400 Received: by mail-pg0-x241.google.com with SMTP id j186so28790021pge.1 for ; Tue, 04 Jul 2017 15:31:59 -0700 (PDT) Sender: Richard Henderson References: <149865219962.17063.10630533069463266646.stgit@frigg.lan> <149865316837.17063.1608754834009945976.stgit@frigg.lan> <528c921e-d04c-f064-08f8-2c6a0b3f23f1@twiddle.net> <8760f8av0c.fsf@frigg.lan> From: Richard Henderson Message-ID: Date: Tue, 4 Jul 2017 12:31:51 -1000 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v11 04/29] target: [tcg] Add generic translation framework List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , QEMU Developers , Paolo Bonzini , Peter Crosthwaite , "Emilio G. Cota" , =?UTF-8?Q?Alex_Benn=c3=a9e?= On 07/04/2017 09:14 AM, Peter Maydell wrote: > On 4 July 2017 at 19:59, LluĂ­s Vilanova wrote: >> Richard Henderson writes: >>> Any reason not to stuff the cpu pointer into the DisasContextBase instead of >>> passing it around separately? >> >> None, really. I'll move it from DisasContext (in targets where it's present) >> into DisasContextBase, and use that one everywhere. > > I kind of like not having CPUState* in DisasContext, because > it enforces the rule that you can't read from fields of > it inside the target translate.c code without jumping through > a hoop (ie copying the info from CPUState->foo to > DisasContext->foo). That then acts as a useful flag in code > review (or when writing the code) to confirm that foo really > is constant for the life of the simulation (or to recommend > using a TB flag instead). I don't see how the spelling "cpu" vs "dc->cpu" really affects that. More practically, I don't see that "cpu" will actually be used by most of those hooks. But because of things like cpu->some_target_feature, it's kind of hard to predict. r~