From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPTZN-0006Kg-RZ for qemu-devel@nongnu.org; Tue, 09 Apr 2013 04:06:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPTZF-0003gc-Rz for qemu-devel@nongnu.org; Tue, 09 Apr 2013 04:06:21 -0400 Received: from csmailer.cs.nctu.edu.tw ([140.113.235.130]:45184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPTZF-0003eU-4O for qemu-devel@nongnu.org; Tue, 09 Apr 2013 04:06:13 -0400 Date: Tue, 9 Apr 2013 16:05:29 +0800 From: =?utf-8?B?6Zmz6Z+L5Lu7IChXZWktUmVuIENoZW4p?= Message-ID: <20130409080529.GA86334@cs.nctu.edu.tw> References: <1365479139-18737-1-git-send-email-lig.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1365479139-18737-1-git-send-email-lig.fnst@cn.fujitsu.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] translate: optimize gen_intermediate_code_internal List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: liguang Cc: peter.maydell@linaro.org, proljc@gmail.com, e.voevodin@samsung.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, paul@codesourcery.com, pbonzini@redhat.com, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net Hi liguang, Just to be curious, how much performance improvement this patch can get= ? Regards, chenwj On Tue, Apr 09, 2013 at 11:45:39AM +0800, liguang wrote: > Signed-off-by: liguang > --- > target-arm/translate.c | 17 ++++++++--------- > target-i386/translate.c | 17 ++++++++--------- > target-mips/translate.c | 16 ++++++++-------- > 3 files changed, 24 insertions(+), 26 deletions(-) >=20 > diff --git a/target-arm/translate.c b/target-arm/translate.c > index 35a21be..c0c080d 100644 > --- a/target-arm/translate.c > +++ b/target-arm/translate.c > @@ -9806,11 +9806,10 @@ static inline void gen_intermediate_code_intern= al(CPUARMState *env, > cpu_M0 =3D tcg_temp_new_i64(); > next_page_start =3D (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SI= ZE; > lj =3D -1; > - num_insns =3D 0; > max_insns =3D tb->cflags & CF_COUNT_MASK; > - if (max_insns =3D=3D 0) > + if (max_insns =3D=3D 0) { > max_insns =3D CF_COUNT_MASK; > - > + } > gen_tb_start(); > =20 > tcg_clear_temp_count(); > @@ -9889,9 +9888,9 @@ static inline void gen_intermediate_code_internal= (CPUARMState *env, > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } > tcg_ctx.gen_opc_pc[lj] =3D dc->pc; > gen_opc_condexec_bits[lj] =3D (dc->condexec_cond << 4) | (= dc->condexec_mask >> 1); > @@ -10028,9 +10027,9 @@ done_generating: > #endif > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <=3D j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj <=3D j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } else { > tb->size =3D dc->pc - pc_start; > tb->icount =3D num_insns; > diff --git a/target-i386/translate.c b/target-i386/translate.c > index 7596a90..9c5e1a3 100644 > --- a/target-i386/translate.c > +++ b/target-i386/translate.c > @@ -8319,11 +8319,10 @@ static inline void gen_intermediate_code_intern= al(CPUX86State *env, > dc->is_jmp =3D DISAS_NEXT; > pc_ptr =3D pc_start; > lj =3D -1; > - num_insns =3D 0; > max_insns =3D tb->cflags & CF_COUNT_MASK; > - if (max_insns =3D=3D 0) > + if (max_insns =3D=3D 0) { > max_insns =3D CF_COUNT_MASK; > - > + } > gen_tb_start(); > for(;;) { > if (unlikely(!QTAILQ_EMPTY(&env->breakpoints))) { > @@ -8338,9 +8337,9 @@ static inline void gen_intermediate_code_internal= (CPUX86State *env, > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } > tcg_ctx.gen_opc_pc[lj] =3D pc_ptr; > gen_opc_cc_op[lj] =3D dc->cc_op; > @@ -8387,9 +8386,9 @@ static inline void gen_intermediate_code_internal= (CPUX86State *env, > /* we don't forget to fill the last values */ > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <=3D j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj <=3D j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } > =20 > #ifdef DEBUG_DISAS > diff --git a/target-mips/translate.c b/target-mips/translate.c > index b7f8203..d1e5d84 100644 > --- a/target-mips/translate.c > +++ b/target-mips/translate.c > @@ -15571,10 +15571,10 @@ gen_intermediate_code_internal (CPUMIPSState = *env, TranslationBlock *tb, > #else > ctx.mem_idx =3D ctx.hflags & MIPS_HFLAG_KSU; > #endif > - num_insns =3D 0; > max_insns =3D tb->cflags & CF_COUNT_MASK; > - if (max_insns =3D=3D 0) > + if (max_insns =3D=3D 0) { > max_insns =3D CF_COUNT_MASK; > + } > LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hfl= ags); > gen_tb_start(); > while (ctx.bstate =3D=3D BS_NONE) { > @@ -15595,9 +15595,9 @@ gen_intermediate_code_internal (CPUMIPSState *e= nv, TranslationBlock *tb, > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } > tcg_ctx.gen_opc_pc[lj] =3D ctx.pc; > gen_opc_hflags[lj] =3D ctx.hflags & MIPS_HFLAG_BMASK; > @@ -15678,9 +15678,9 @@ done_generating: > *tcg_ctx.gen_opc_ptr =3D INDEX_op_end; > if (search_pc) { > j =3D tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <=3D j) > - tcg_ctx.gen_opc_instr_start[lj++] =3D 0; > + while (++lj <=3D j) { > + tcg_ctx.gen_opc_instr_start[lj] =3D 0; > + } > } else { > tb->size =3D ctx.pc - pc_start; > tb->icount =3D num_insns; > --=20 > 1.7.2.5 >=20 --=20 Wei-Ren Chen (=E9=99=B3=E9=9F=8B=E4=BB=BB) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj