From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTWcT-0005GI-3J for qemu-devel@nongnu.org; Wed, 10 Feb 2016 10:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTWcO-0006k2-W3 for qemu-devel@nongnu.org; Wed, 10 Feb 2016 10:23:53 -0500 Received: from mail-wm0-x231.google.com ([2a00:1450:400c:c09::231]:37786) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTWcO-0006jp-Kx for qemu-devel@nongnu.org; Wed, 10 Feb 2016 10:23:48 -0500 Received: by mail-wm0-x231.google.com with SMTP id g62so31430839wme.0 for ; Wed, 10 Feb 2016 07:23:48 -0800 (PST) References: <1454597781-18115-1-git-send-email-alex.bennee@linaro.org> <1454597781-18115-2-git-send-email-alex.bennee@linaro.org> <56B3C17A.5060204@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <56B3C17A.5060204@twiddle.net> Date: Wed, 10 Feb 2016 15:23:45 +0000 Message-ID: <87y4asvbb2.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v5 1/9] tcg: pass down TranslationBlock to tcg_code_gen List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: peter.maydell@linaro.org, Peter Crosthwaite , qemu-devel@nongnu.org, dgilbert@redhat.com, crosthwaitepeter@gmail.com, pbonzini@redhat.com, aurelien@aurel32.net Richard Henderson writes: > On 02/05/2016 01:56 AM, Alex Bennée wrote: >> diff --git a/translate-all.c b/translate-all.c >> index ab61fac..dce00d5 100644 >> --- a/translate-all.c >> +++ b/translate-all.c >> @@ -1055,7 +1055,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, >> TranslationBlock *tb; >> tb_page_addr_t phys_pc, phys_page2; >> target_ulong virt_page2; >> - tcg_insn_unit *gen_code_buf; >> int gen_code_size, search_size; >> #ifdef CONFIG_PROFILER >> int64_t ti; >> @@ -1078,8 +1077,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, >> tcg_ctx.tb_ctx.tb_invalidated_flag = 1; >> } >> >> - gen_code_buf = tcg_ctx.code_gen_ptr; >> - tb->tc_ptr = gen_code_buf; >> + tb->tc_ptr = tcg_ctx.code_gen_ptr; > > Why get rid of the gen_code_buf variable? You're forcing the compiler to keep > reloading the value from memory. > > Certainly that's not relevant to passing down TB to tcg_gen_code, and is a > separate change that ought to be separately defended. Fixed. Thanks. > > > r~ > >> tb->cs_base = cs_base; >> tb->flags = flags; >> tb->cflags = cflags; >> @@ -1119,11 +1117,11 @@ TranslationBlock *tb_gen_code(CPUState *cpu, >> the tcg optimization currently hidden inside tcg_gen_code. All >> that should be required is to flush the TBs, allocate a new TB, >> re-initialize it per above, and re-do the actual code generation. */ >> - gen_code_size = tcg_gen_code(&tcg_ctx, gen_code_buf); >> + gen_code_size = tcg_gen_code(&tcg_ctx, tb); >> if (unlikely(gen_code_size < 0)) { >> goto buffer_overflow; >> } >> - search_size = encode_search(tb, (void *)gen_code_buf + gen_code_size); >> + search_size = encode_search(tb, (void *)tb->tc_ptr + gen_code_size); >> if (unlikely(search_size < 0)) { >> goto buffer_overflow; >> } >> @@ -1145,7 +1143,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, >> #endif >> >> tcg_ctx.code_gen_ptr = (void *) >> - ROUND_UP((uintptr_t)gen_code_buf + gen_code_size + search_size, >> + ROUND_UP((uintptr_t)tb->tc_ptr + gen_code_size + search_size, >> CODE_GEN_ALIGN); >> >> /* check next page if needed */ >> -- Alex Bennée