From: "陳韋任 (Wei-Ren Chen)" <chenwj@iis.sinica.edu.tw>
To: liguang <lig.fnst@cn.fujitsu.com>
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
Subject: Re: [Qemu-devel] [PATCH] translate: optimize gen_intermediate_code_internal
Date: Tue, 9 Apr 2013 16:05:29 +0800 [thread overview]
Message-ID: <20130409080529.GA86334@cs.nctu.edu.tw> (raw)
In-Reply-To: <1365479139-18737-1-git-send-email-lig.fnst@cn.fujitsu.com>
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 <lig.fnst@cn.fujitsu.com>
> ---
> 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;
> 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;
> --
> 1.7.2.5
>
--
Wei-Ren Chen (陳韋任)
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
next prev parent reply other threads:[~2013-04-09 8:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-09 3:45 [Qemu-devel] [PATCH] translate: optimize gen_intermediate_code_internal liguang
2013-04-09 8:05 ` 陳韋任 (Wei-Ren Chen) [this message]
2013-04-09 8:11 ` Paolo Bonzini
2013-04-09 8:21 ` li guang
2013-04-09 9:08 ` Peter Maydell
2013-04-10 0:28 ` li guang
2013-04-10 2:31 ` 陳韋任 (Wei-Ren Chen)
2013-04-10 2:38 ` li guang
2013-04-10 2:58 ` 陳韋任 (Wei-Ren Chen)
2013-04-10 3:03 ` li guang
2013-04-09 9:20 ` 陳韋任 (Wei-Ren Chen)
2013-04-11 2:12 ` li guang
2013-04-09 8:33 ` 陳韋任 (Wei-Ren Chen)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130409080529.GA86334@cs.nctu.edu.tw \
--to=chenwj@iis.sinica.edu.tw \
--cc=afaerber@suse.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=e.voevodin@samsung.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=paul@codesourcery.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).