From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPphl-0007Ia-LK for qemu-devel@nongnu.org; Wed, 10 Apr 2013 03:44:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPphj-0007PU-Bh for qemu-devel@nongnu.org; Wed, 10 Apr 2013 03:44:29 -0400 Received: from mail-bk0-x231.google.com ([2a00:1450:4008:c01::231]:59799) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPphj-0007PD-1R for qemu-devel@nongnu.org; Wed, 10 Apr 2013 03:44:27 -0400 Received: by mail-bk0-f49.google.com with SMTP id w12so66723bku.22 for ; Wed, 10 Apr 2013 00:44:26 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <51651853.6090701@redhat.com> Date: Wed, 10 Apr 2013 09:44:19 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1365564652-26981-1-git-send-email-lig.fnst@cn.fujitsu.com> In-Reply-To: <1365564652-26981-1-git-send-email-lig.fnst@cn.fujitsu.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] translate: cleanup 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, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net Il 10/04/2013 05:30, liguang ha scritto: > 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(-) > > 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_internal(CPUARMState *env, > cpu_M0 = tcg_temp_new_i64(); > next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; > lj = -1; > - num_insns = 0; Nack. Did you even try to read what I and Wei-Ren Chen were trying to tell you? Paolo > max_insns = tb->cflags & CF_COUNT_MASK; > - if (max_insns == 0) > + if (max_insns == 0) { > max_insns = CF_COUNT_MASK; > - > + } > gen_tb_start(); > > tcg_clear_temp_count(); > @@ -9889,9 +9888,9 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, > if (search_pc) { > j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } > tcg_ctx.gen_opc_pc[lj] = dc->pc; > gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1); > @@ -10028,9 +10027,9 @@ done_generating: > #endif > if (search_pc) { > j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <= j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj <= j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } else { > tb->size = dc->pc - pc_start; > tb->icount = 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_internal(CPUX86State *env, > dc->is_jmp = DISAS_NEXT; > pc_ptr = pc_start; > lj = -1; > - num_insns = 0; > max_insns = tb->cflags & CF_COUNT_MASK; > - if (max_insns == 0) > + if (max_insns == 0) { > max_insns = 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 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } > tcg_ctx.gen_opc_pc[lj] = pc_ptr; > gen_opc_cc_op[lj] = 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 = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <= j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj <= j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } > > #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 = ctx.hflags & MIPS_HFLAG_KSU; > #endif > - num_insns = 0; > max_insns = tb->cflags & CF_COUNT_MASK; > - if (max_insns == 0) > + if (max_insns == 0) { > max_insns = CF_COUNT_MASK; > + } > LOG_DISAS("\ntb %p idx %d hflags %04x\n", tb, ctx.mem_idx, ctx.hflags); > gen_tb_start(); > while (ctx.bstate == BS_NONE) { > @@ -15595,9 +15595,9 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb, > if (search_pc) { > j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > if (lj < j) { > - lj++; > - while (lj < j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj < j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } > tcg_ctx.gen_opc_pc[lj] = ctx.pc; > gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK; > @@ -15678,9 +15678,9 @@ done_generating: > *tcg_ctx.gen_opc_ptr = INDEX_op_end; > if (search_pc) { > j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf; > - lj++; > - while (lj <= j) > - tcg_ctx.gen_opc_instr_start[lj++] = 0; > + while (++lj <= j) { > + tcg_ctx.gen_opc_instr_start[lj] = 0; > + } > } else { > tb->size = ctx.pc - pc_start; > tb->icount = num_insns; >