All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up
@ 2012-11-21  7:43 Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 1/5] tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext Evgeny Voevodin
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

This set of patches moves global variables to tcg_ctx:
gen_opc_instr
gen_opparam_icount
gen_opc_pc

Build tested for all targets.
Execution tested on Exynos4210 target.

After this patchset was aplied,
I noticed no speed-up or slow-down of code generation.

Here is the test procedure:
1. Boot Linux Kernel 5 times.
2. For each iteration wait while "JIT cycles" is stable for ~10 seconds
3. Write down the "cycles/op"

Here are the results (tested on gcc-4.6):

Before clean-up:
min: 655.5
max: 659.3
avg: 657.2
standard deviation: ~2 ~= 0.4%

Average cycles/op = 657 +- 2



After clean-up:
min: 654.6
max: 657.1
avg: 655.5
standard deviation: ~1 ~= 0.2%

Average cycles/op = 656 +- 1

Evgeny Voevodin (5):
  tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
  TCG: Use gen_opc_pc from context instead of global variable.
  TCG: Use gen_opc_icount from context instead of global variable.
  TCG: Use gen_opc_instr_start from context instead of global variable.
  TCG: Remove unused global gen_opc_ arrays.

 exec-all.h                    |    4 ----
 target-alpha/translate.c      |   12 ++++++------
 target-arm/translate.c        |   12 ++++++------
 target-cris/translate.c       |   14 +++++++-------
 target-i386/translate.c       |   19 ++++++++++---------
 target-lm32/translate.c       |   12 ++++++------
 target-m68k/translate.c       |   12 ++++++------
 target-microblaze/translate.c |   12 ++++++------
 target-mips/translate.c       |   12 ++++++------
 target-openrisc/translate.c   |   12 ++++++------
 target-ppc/translate.c        |   12 ++++++------
 target-s390x/translate.c      |   12 ++++++------
 target-sh4/translate.c        |   12 ++++++------
 target-sparc/translate.c      |   12 ++++++------
 target-unicore32/translate.c  |   12 ++++++------
 target-xtensa/translate.c     |   10 +++++-----
 tcg/tcg.h                     |    3 +++
 translate-all.c               |    9 +++------
 18 files changed, 100 insertions(+), 103 deletions(-)

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 1/5] tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
@ 2012-11-21  7:43 ` Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 2/5] TCG: Use gen_opc_pc from context instead of global variable Evgeny Voevodin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 tcg/tcg.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tcg/tcg.h b/tcg/tcg.h
index 9481e35..f6e255f 100644
--- a/tcg/tcg.h
+++ b/tcg/tcg.h
@@ -455,6 +455,9 @@ struct TCGContext {
 
     uint16_t *gen_opc_ptr;
     TCGArg *gen_opparam_ptr;
+    target_ulong gen_opc_pc[OPC_BUF_SIZE];
+    uint16_t gen_opc_icount[OPC_BUF_SIZE];
+    uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
 
 #if defined(CONFIG_QEMU_LDST_OPTIMIZATION) && defined(CONFIG_SOFTMMU)
     /* labels info for qemu_ld/st IRs
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 2/5] TCG: Use gen_opc_pc from context instead of global variable.
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 1/5] tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext Evgeny Voevodin
@ 2012-11-21  7:43 ` Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 3/5] TCG: Use gen_opc_icount " Evgeny Voevodin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 target-alpha/translate.c      |    4 ++--
 target-arm/translate.c        |    4 ++--
 target-cris/translate.c       |    6 +++---
 target-i386/translate.c       |    9 +++++----
 target-lm32/translate.c       |    4 ++--
 target-m68k/translate.c       |    4 ++--
 target-microblaze/translate.c |    4 ++--
 target-mips/translate.c       |    4 ++--
 target-openrisc/translate.c   |    4 ++--
 target-ppc/translate.c        |    4 ++--
 target-s390x/translate.c      |    4 ++--
 target-sh4/translate.c        |    4 ++--
 target-sparc/translate.c      |    4 ++--
 target-unicore32/translate.c  |    4 ++--
 target-xtensa/translate.c     |    4 ++--
 15 files changed, 34 insertions(+), 33 deletions(-)

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 4045f78..bcde367 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -3412,7 +3412,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = ctx.pc;
+            tcg_ctx.gen_opc_pc[lj] = ctx.pc;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
         }
@@ -3551,5 +3551,5 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
 
 void restore_state_to_opc(CPUAlphaState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-arm/translate.c b/target-arm/translate.c
index c42110a..8ea8bba 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9840,7 +9840,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = dc->pc;
+            tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1);
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
@@ -10043,6 +10043,6 @@ void cpu_dump_state(CPUARMState *env, FILE *f, fprintf_function cpu_fprintf,
 
 void restore_state_to_opc(CPUARMState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->regs[15] = gen_opc_pc[pc_pos];
+    env->regs[15] = tcg_ctx.gen_opc_pc[pc_pos];
     env->condexec_bits = gen_opc_condexec_bits[pc_pos];
 }
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 0b0e86d..745cd7a 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3305,9 +3305,9 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
                 }
             }
             if (dc->delayed_branch == 1) {
-                gen_opc_pc[lj] = dc->ppc | 1;
+                tcg_ctx.gen_opc_pc[lj] = dc->ppc | 1;
             } else {
-                gen_opc_pc[lj] = dc->pc;
+                tcg_ctx.gen_opc_pc[lj] = dc->pc;
             }
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
@@ -3621,5 +3621,5 @@ CRISCPU *cpu_cris_init(const char *cpu_model)
 
 void restore_state_to_opc(CPUCRISState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 8e676ba..aea843c 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7990,7 +7990,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = pc_ptr;
+            tcg_ctx.gen_opc_pc[lj] = pc_ptr;
             gen_opc_cc_op[lj] = dc->cc_op;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
@@ -8081,15 +8081,16 @@ void restore_state_to_opc(CPUX86State *env, TranslationBlock *tb, int pc_pos)
         qemu_log("RESTORE:\n");
         for(i = 0;i <= pc_pos; i++) {
             if (gen_opc_instr_start[i]) {
-                qemu_log("0x%04x: " TARGET_FMT_lx "\n", i, gen_opc_pc[i]);
+                qemu_log("0x%04x: " TARGET_FMT_lx "\n", i,
+                        tcg_ctx.gen_opc_pc[i]);
             }
         }
         qemu_log("pc_pos=0x%x eip=" TARGET_FMT_lx " cs_base=%x\n",
-                pc_pos, gen_opc_pc[pc_pos] - tb->cs_base,
+                pc_pos, tcg_ctx.gen_opc_pc[pc_pos] - tb->cs_base,
                 (uint32_t)tb->cs_base);
     }
 #endif
-    env->eip = gen_opc_pc[pc_pos] - tb->cs_base;
+    env->eip = tcg_ctx.gen_opc_pc[pc_pos] - tb->cs_base;
     cc_op = gen_opc_cc_op[pc_pos];
     if (cc_op != CC_OP_DYNAMIC)
         env->cc_op = cc_op;
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index af98649..fcafb06 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -1054,7 +1054,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
                     gen_opc_instr_start[lj++] = 0;
                 }
             }
-            gen_opc_pc[lj] = dc->pc;
+            tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
         }
@@ -1172,7 +1172,7 @@ void cpu_dump_state(CPULM32State *env, FILE *f, fprintf_function cpu_fprintf,
 
 void restore_state_to_opc(CPULM32State *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
 
 void lm32_translate_init(void)
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index b13be48..74772dd 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3021,7 +3021,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = dc->pc;
+            tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
         }
@@ -3121,5 +3121,5 @@ void cpu_dump_state(CPUM68KState *env, FILE *f, fprintf_function cpu_fprintf,
 
 void restore_state_to_opc(CPUM68KState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index cce4494..6803f73 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1790,7 +1790,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = dc->pc;
+            tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
                         gen_opc_icount[lj] = num_insns;
         }
@@ -2014,5 +2014,5 @@ MicroBlazeCPU *cpu_mb_init(const char *cpu_model)
 
 void restore_state_to_opc(CPUMBState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->sregs[SR_PC] = gen_opc_pc[pc_pos];
+    env->sregs[SR_PC] = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 8b438f8..17d5ece 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -15555,7 +15555,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = ctx.pc;
+            tcg_ctx.gen_opc_pc[lj] = ctx.pc;
             gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK;
             gen_opc_btarget[lj] = ctx.btarget;
             gen_opc_instr_start[lj] = 1;
@@ -15976,7 +15976,7 @@ void cpu_state_reset(CPUMIPSState *env)
 
 void restore_state_to_opc(CPUMIPSState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->active_tc.PC = gen_opc_pc[pc_pos];
+    env->active_tc.PC = tcg_ctx.gen_opc_pc[pc_pos];
     env->hflags &= ~MIPS_HFLAG_BMASK;
     env->hflags |= gen_opc_hflags[pc_pos];
     switch (env->hflags & MIPS_HFLAG_BMASK_BASE) {
diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index f14da7b..b7ad6a4 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -1710,7 +1710,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
                     gen_opc_instr_start[k++] = 0;
                 }
             }
-            gen_opc_pc[k] = dc->pc;
+            tcg_ctx.gen_opc_pc[k] = dc->pc;
             gen_opc_instr_start[k] = 1;
             gen_opc_icount[k] = num_insns;
         }
@@ -1832,5 +1832,5 @@ void cpu_dump_state(CPUOpenRISCState *env, FILE *f,
 void restore_state_to_opc(CPUOpenRISCState *env, TranslationBlock *tb,
                           int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 16b9c5d..fcdfa1a 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9681,7 +9681,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
             }
-            gen_opc_pc[lj] = ctx.nip;
+            tcg_ctx.gen_opc_pc[lj] = ctx.nip;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
         }
@@ -9809,5 +9809,5 @@ void gen_intermediate_code_pc (CPUPPCState *env, struct TranslationBlock *tb)
 
 void restore_state_to_opc(CPUPPCState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->nip = gen_opc_pc[pc_pos];
+    env->nip = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 993f207..ff2868f 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -5163,7 +5163,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
                     gen_opc_instr_start[lj++] = 0;
                 }
             }
-            gen_opc_pc[lj] = dc.pc;
+            tcg_ctx.gen_opc_pc[lj] = dc.pc;
             gen_opc_cc_op[lj] = dc.cc_op;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
@@ -5240,7 +5240,7 @@ void gen_intermediate_code_pc (CPUS390XState *env, struct TranslationBlock *tb)
 void restore_state_to_opc(CPUS390XState *env, TranslationBlock *tb, int pc_pos)
 {
     int cc_op;
-    env->psw.addr = gen_opc_pc[pc_pos];
+    env->psw.addr = tcg_ctx.gen_opc_pc[pc_pos];
     cc_op = gen_opc_cc_op[pc_pos];
     if ((cc_op != CC_OP_DYNAMIC) && (cc_op != CC_OP_STATIC)) {
         env->cc_op = cc_op;
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 5497ded..4def163 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -2005,7 +2005,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
                 while (ii < i)
                     gen_opc_instr_start[ii++] = 0;
             }
-            gen_opc_pc[ii] = ctx.pc;
+            tcg_ctx.gen_opc_pc[ii] = ctx.pc;
             gen_opc_hflags[ii] = ctx.flags;
             gen_opc_instr_start[ii] = 1;
             gen_opc_icount[ii] = num_insns;
@@ -2088,6 +2088,6 @@ void gen_intermediate_code_pc(CPUSH4State * env, struct TranslationBlock *tb)
 
 void restore_state_to_opc(CPUSH4State *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
     env->flags = gen_opc_hflags[pc_pos];
 }
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 2ae8036..4f3a844 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5284,7 +5284,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
                 lj++;
                 while (lj < j)
                     gen_opc_instr_start[lj++] = 0;
-                gen_opc_pc[lj] = dc->pc;
+                tcg_ctx.gen_opc_pc[lj] = dc->pc;
                 gen_opc_npc[lj] = dc->npc;
                 gen_opc_instr_start[lj] = 1;
                 gen_opc_icount[lj] = num_insns;
@@ -5478,7 +5478,7 @@ void gen_intermediate_code_init(CPUSPARCState *env)
 void restore_state_to_opc(CPUSPARCState *env, TranslationBlock *tb, int pc_pos)
 {
     target_ulong npc;
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
     npc = gen_opc_npc[pc_pos];
     if (npc == 1) {
         /* dynamic NPC: already stored */
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index 052bb45..32a4265 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -2006,7 +2006,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env,
                     gen_opc_instr_start[lj++] = 0;
                 }
             }
-            gen_opc_pc[lj] = dc->pc;
+            tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = num_insns;
         }
@@ -2203,5 +2203,5 @@ void cpu_dump_state(CPUUniCore32State *env, FILE *f,
 
 void restore_state_to_opc(CPUUniCore32State *env, TranslationBlock *tb, int pc_pos)
 {
-    env->regs[31] = gen_opc_pc[pc_pos];
+    env->regs[31] = tcg_ctx.gen_opc_pc[pc_pos];
 }
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index e5a3f49..21126fc 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -2900,7 +2900,7 @@ static void gen_intermediate_code_internal(
                     gen_opc_instr_start[lj++] = 0;
                 }
             }
-            gen_opc_pc[lj] = dc.pc;
+            tcg_ctx.gen_opc_pc[lj] = dc.pc;
             gen_opc_instr_start[lj] = 1;
             gen_opc_icount[lj] = insn_count;
         }
@@ -3028,5 +3028,5 @@ void cpu_dump_state(CPUXtensaState *env, FILE *f, fprintf_function cpu_fprintf,
 
 void restore_state_to_opc(CPUXtensaState *env, TranslationBlock *tb, int pc_pos)
 {
-    env->pc = gen_opc_pc[pc_pos];
+    env->pc = tcg_ctx.gen_opc_pc[pc_pos];
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 3/5] TCG: Use gen_opc_icount from context instead of global variable.
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 1/5] tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 2/5] TCG: Use gen_opc_pc from context instead of global variable Evgeny Voevodin
@ 2012-11-21  7:43 ` Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 4/5] TCG: Use gen_opc_instr_start " Evgeny Voevodin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 target-alpha/translate.c      |    2 +-
 target-arm/translate.c        |    2 +-
 target-cris/translate.c       |    2 +-
 target-i386/translate.c       |    2 +-
 target-lm32/translate.c       |    2 +-
 target-m68k/translate.c       |    2 +-
 target-microblaze/translate.c |    2 +-
 target-mips/translate.c       |    2 +-
 target-openrisc/translate.c   |    2 +-
 target-ppc/translate.c        |    2 +-
 target-s390x/translate.c      |    2 +-
 target-sh4/translate.c        |    2 +-
 target-sparc/translate.c      |    2 +-
 target-unicore32/translate.c  |    2 +-
 target-xtensa/translate.c     |    2 +-
 translate-all.c               |    2 +-
 16 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index bcde367..8b73fbb 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -3414,7 +3414,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
             }
             tcg_ctx.gen_opc_pc[lj] = ctx.pc;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 8ea8bba..4695d8b 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9843,7 +9843,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_condexec_bits[lj] = (dc->condexec_cond << 4) | (dc->condexec_mask >> 1);
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 745cd7a..6ec8c3c 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3310,7 +3310,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
                 tcg_ctx.gen_opc_pc[lj] = dc->pc;
             }
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
         /* Pretty disas.  */
diff --git a/target-i386/translate.c b/target-i386/translate.c
index aea843c..80fb695 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7993,7 +7993,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
             tcg_ctx.gen_opc_pc[lj] = pc_ptr;
             gen_opc_cc_op[lj] = dc->cc_op;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index fcafb06..4e029e0 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -1056,7 +1056,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
         /* Pretty disas.  */
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 74772dd..0762085 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3023,7 +3023,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 6803f73..d975756 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1792,7 +1792,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
-                        gen_opc_icount[lj] = num_insns;
+                        tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
         /* Pretty disas.  */
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 17d5ece..81807cf 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -15559,7 +15559,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
             gen_opc_hflags[lj] = ctx.hflags & MIPS_HFLAG_BMASK;
             gen_opc_btarget[lj] = ctx.btarget;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index b7ad6a4..5b08314 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -1712,7 +1712,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
             }
             tcg_ctx.gen_opc_pc[k] = dc->pc;
             gen_opc_instr_start[k] = 1;
-            gen_opc_icount[k] = num_insns;
+            tcg_ctx.gen_opc_icount[k] = num_insns;
         }
 
         if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index fcdfa1a..bbe2390 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9683,7 +9683,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
             }
             tcg_ctx.gen_opc_pc[lj] = ctx.nip;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         LOG_DISAS("----------------\n");
         LOG_DISAS("nip=" TARGET_FMT_lx " super=%d ir=%d\n",
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index ff2868f..b2774ee 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -5166,7 +5166,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
             tcg_ctx.gen_opc_pc[lj] = dc.pc;
             gen_opc_cc_op[lj] = dc.cc_op;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
             gen_io_start();
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 4def163..ca76be5 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -2008,7 +2008,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
             tcg_ctx.gen_opc_pc[ii] = ctx.pc;
             gen_opc_hflags[ii] = ctx.flags;
             gen_opc_instr_start[ii] = 1;
-            gen_opc_icount[ii] = num_insns;
+            tcg_ctx.gen_opc_icount[ii] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 4f3a844..cbb8997 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5287,7 +5287,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
                 tcg_ctx.gen_opc_pc[lj] = dc->pc;
                 gen_opc_npc[lj] = dc->npc;
                 gen_opc_instr_start[lj] = 1;
-                gen_opc_icount[lj] = num_insns;
+                tcg_ctx.gen_opc_icount[lj] = num_insns;
             }
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index 32a4265..0562615 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -2008,7 +2008,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env,
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = num_insns;
+            tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index 21126fc..e93c2e6 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -2902,7 +2902,7 @@ static void gen_intermediate_code_internal(
             }
             tcg_ctx.gen_opc_pc[lj] = dc.pc;
             gen_opc_instr_start[lj] = 1;
-            gen_opc_icount[lj] = insn_count;
+            tcg_ctx.gen_opc_icount[lj] = insn_count;
         }
 
         if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP | CPU_LOG_TB_OP_OPT))) {
diff --git a/translate-all.c b/translate-all.c
index d9c2e57..177e95a 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -148,7 +148,7 @@ int cpu_restore_state(TranslationBlock *tb,
     /* now find start of instruction before */
     while (gen_opc_instr_start[j] == 0)
         j--;
-    env->icount_decr.u16.low -= gen_opc_icount[j];
+    env->icount_decr.u16.low -= s->gen_opc_icount[j];
 
     restore_state_to_opc(env, tb, j);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 4/5] TCG: Use gen_opc_instr_start from context instead of global variable.
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
                   ` (2 preceding siblings ...)
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 3/5] TCG: Use gen_opc_icount " Evgeny Voevodin
@ 2012-11-21  7:43 ` Evgeny Voevodin
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 5/5] TCG: Remove unused global gen_opc_ arrays Evgeny Voevodin
  2012-11-26  4:19 ` [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
  5 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 target-alpha/translate.c      |    6 +++---
 target-arm/translate.c        |    6 +++---
 target-cris/translate.c       |    6 +++---
 target-i386/translate.c       |    8 ++++----
 target-lm32/translate.c       |    6 +++---
 target-m68k/translate.c       |    6 +++---
 target-microblaze/translate.c |    6 +++---
 target-mips/translate.c       |    6 +++---
 target-openrisc/translate.c   |    6 +++---
 target-ppc/translate.c        |    6 +++---
 target-s390x/translate.c      |    6 +++---
 target-sh4/translate.c        |    6 +++---
 target-sparc/translate.c      |    6 +++---
 target-unicore32/translate.c  |    6 +++---
 target-xtensa/translate.c     |    4 ++--
 translate-all.c               |    3 ++-
 16 files changed, 47 insertions(+), 46 deletions(-)

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 8b73fbb..71fe1a1 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -3410,10 +3410,10 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
             }
             tcg_ctx.gen_opc_pc[lj] = ctx.pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
@@ -3468,7 +3468,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = ctx.pc - pc_start;
         tb->icount = num_insns;
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 4695d8b..3cf3604 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -9838,11 +9838,11 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    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);
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
@@ -9977,7 +9977,7 @@ done_generating:
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = dc->pc - pc_start;
         tb->icount = num_insns;
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 6ec8c3c..60bdc24 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -3301,7 +3301,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
             if (lj < j) {
                 lj++;
                 while (lj < j) {
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 }
             }
             if (dc->delayed_branch == 1) {
@@ -3309,7 +3309,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
             } else {
                 tcg_ctx.gen_opc_pc[lj] = dc->pc;
             }
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
@@ -3439,7 +3439,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j) {
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
         }
     } else {
         tb->size = dc->pc - pc_start;
diff --git a/target-i386/translate.c b/target-i386/translate.c
index 80fb695..f394ea6 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -7988,11 +7988,11 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
             }
             tcg_ctx.gen_opc_pc[lj] = pc_ptr;
             gen_opc_cc_op[lj] = dc->cc_op;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
@@ -8037,7 +8037,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     }
 
 #ifdef DEBUG_DISAS
@@ -8080,7 +8080,7 @@ void restore_state_to_opc(CPUX86State *env, TranslationBlock *tb, int pc_pos)
         int i;
         qemu_log("RESTORE:\n");
         for(i = 0;i <= pc_pos; i++) {
-            if (gen_opc_instr_start[i]) {
+            if (tcg_ctx.gen_opc_instr_start[i]) {
                 qemu_log("0x%04x: " TARGET_FMT_lx "\n", i,
                         tcg_ctx.gen_opc_pc[i]);
             }
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index 4e029e0..e131ad1 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -1051,11 +1051,11 @@ static void gen_intermediate_code_internal(CPULM32State *env,
             if (lj < j) {
                 lj++;
                 while (lj < j) {
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 }
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
@@ -1110,7 +1110,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j) {
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
         }
     } else {
         tb->size = dc->pc - pc_start;
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 0762085..11defc6 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -3019,10 +3019,10 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
@@ -3078,7 +3078,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = dc->pc - pc_start;
         tb->icount = num_insns;
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index d975756..6ceff02 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -1788,10 +1788,10 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
                         tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
@@ -1902,7 +1902,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = dc->pc - pc_start;
                 tb->icount = num_insns;
diff --git a/target-mips/translate.c b/target-mips/translate.c
index 81807cf..1a5e3d6 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -15553,12 +15553,12 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    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;
             gen_opc_btarget[lj] = ctx.btarget;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
@@ -15636,7 +15636,7 @@ done_generating:
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = ctx.pc - pc_start;
         tb->icount = num_insns;
diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index 5b08314..9ac999a 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -1707,11 +1707,11 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
             if (k < j) {
                 k++;
                 while (k < j) {
-                    gen_opc_instr_start[k++] = 0;
+                    tcg_ctx.gen_opc_instr_start[k++] = 0;
                 }
             }
             tcg_ctx.gen_opc_pc[k] = dc->pc;
-            gen_opc_instr_start[k] = 1;
+            tcg_ctx.gen_opc_instr_start[k] = 1;
             tcg_ctx.gen_opc_icount[k] = num_insns;
         }
 
@@ -1787,7 +1787,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         k++;
         while (k <= j) {
-            gen_opc_instr_start[k++] = 0;
+            tcg_ctx.gen_opc_instr_start[k++] = 0;
         }
     } else {
         tb->size = dc->pc - pc_start;
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index bbe2390..ed0aa83 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -9679,10 +9679,10 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
             }
             tcg_ctx.gen_opc_pc[lj] = ctx.nip;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         LOG_DISAS("----------------\n");
@@ -9780,7 +9780,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
     } else {
         tb->size = ctx.nip - pc_start;
         tb->icount = num_insns;
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index b2774ee..787e3c6 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -5160,12 +5160,12 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
             if (lj < j) {
                 lj++;
                 while (lj < j) {
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 }
             }
             tcg_ctx.gen_opc_pc[lj] = dc.pc;
             gen_opc_cc_op[lj] = dc.cc_op;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO)) {
@@ -5212,7 +5212,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j) {
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
         }
     } else {
         tb->size = dc.pc - pc_start;
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index ca76be5..86493e1 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -2003,11 +2003,11 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
             if (ii < i) {
                 ii++;
                 while (ii < i)
-                    gen_opc_instr_start[ii++] = 0;
+                    tcg_ctx.gen_opc_instr_start[ii++] = 0;
             }
             tcg_ctx.gen_opc_pc[ii] = ctx.pc;
             gen_opc_hflags[ii] = ctx.flags;
-            gen_opc_instr_start[ii] = 1;
+            tcg_ctx.gen_opc_instr_start[ii] = 1;
             tcg_ctx.gen_opc_icount[ii] = num_insns;
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
@@ -2061,7 +2061,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,
         i = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         ii++;
         while (ii <= i)
-            gen_opc_instr_start[ii++] = 0;
+            tcg_ctx.gen_opc_instr_start[ii++] = 0;
     } else {
         tb->size = ctx.pc - pc_start;
         tb->icount = num_insns;
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index cbb8997..5859f2e 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -5283,10 +5283,10 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
             if (lj < j) {
                 lj++;
                 while (lj < j)
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 tcg_ctx.gen_opc_pc[lj] = dc->pc;
                 gen_opc_npc[lj] = dc->npc;
-                gen_opc_instr_start[lj] = 1;
+                tcg_ctx.gen_opc_instr_start[lj] = 1;
                 tcg_ctx.gen_opc_icount[lj] = num_insns;
             }
         }
@@ -5339,7 +5339,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j)
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
 #if 0
         log_page_dump();
 #endif
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index 0562615..3951758 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -2003,11 +2003,11 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env,
             if (lj < j) {
                 lj++;
                 while (lj < j) {
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 }
             }
             tcg_ctx.gen_opc_pc[lj] = dc->pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = num_insns;
         }
 
@@ -2117,7 +2117,7 @@ done_generating:
         j = tcg_ctx.gen_opc_ptr - tcg_ctx.gen_opc_buf;
         lj++;
         while (lj <= j) {
-            gen_opc_instr_start[lj++] = 0;
+            tcg_ctx.gen_opc_instr_start[lj++] = 0;
         }
     } else {
         tb->size = dc->pc - pc_start;
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index e93c2e6..828b9ca 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -2897,11 +2897,11 @@ static void gen_intermediate_code_internal(
             if (lj < j) {
                 lj++;
                 while (lj < j) {
-                    gen_opc_instr_start[lj++] = 0;
+                    tcg_ctx.gen_opc_instr_start[lj++] = 0;
                 }
             }
             tcg_ctx.gen_opc_pc[lj] = dc.pc;
-            gen_opc_instr_start[lj] = 1;
+            tcg_ctx.gen_opc_instr_start[lj] = 1;
             tcg_ctx.gen_opc_icount[lj] = insn_count;
         }
 
diff --git a/translate-all.c b/translate-all.c
index 177e95a..2f616bf 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -146,8 +146,9 @@ int cpu_restore_state(TranslationBlock *tb,
     if (j < 0)
         return -1;
     /* now find start of instruction before */
-    while (gen_opc_instr_start[j] == 0)
+    while (s->gen_opc_instr_start[j] == 0) {
         j--;
+    }
     env->icount_decr.u16.low -= s->gen_opc_icount[j];
 
     restore_state_to_opc(env, tb, j);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH 5/5] TCG: Remove unused global gen_opc_ arrays.
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
                   ` (3 preceding siblings ...)
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 4/5] TCG: Use gen_opc_instr_start " Evgeny Voevodin
@ 2012-11-21  7:43 ` Evgeny Voevodin
  2012-11-26  4:19 ` [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
  5 siblings, 0 replies; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-21  7:43 UTC (permalink / raw)
  To: qemu-devel
  Cc: Evgeny Voevodin, blauwirbel, kyungmin.park, edgar.iglesias,
	aurelien, rth

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
---
 exec-all.h      |    4 ----
 translate-all.c |    4 ----
 2 files changed, 8 deletions(-)

diff --git a/exec-all.h b/exec-all.h
index 21aacda..b18d4ca 100644
--- a/exec-all.h
+++ b/exec-all.h
@@ -70,10 +70,6 @@ typedef struct TranslationBlock TranslationBlock;
 
 #define OPPARAM_BUF_SIZE (OPC_BUF_SIZE * MAX_OPC_PARAM)
 
-extern target_ulong gen_opc_pc[OPC_BUF_SIZE];
-extern uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
-extern uint16_t gen_opc_icount[OPC_BUF_SIZE];
-
 #include "qemu-log.h"
 
 void gen_intermediate_code(CPUArchState *env, struct TranslationBlock *tb);
diff --git a/translate-all.c b/translate-all.c
index 2f616bf..f22e3ee 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -33,10 +33,6 @@
 /* code generation context */
 TCGContext tcg_ctx;
 
-target_ulong gen_opc_pc[OPC_BUF_SIZE];
-uint16_t gen_opc_icount[OPC_BUF_SIZE];
-uint8_t gen_opc_instr_start[OPC_BUF_SIZE];
-
 void cpu_gen_init(void)
 {
     tcg_context_init(&tcg_ctx); 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up
  2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
                   ` (4 preceding siblings ...)
  2012-11-21  7:43 ` [Qemu-devel] [PATCH 5/5] TCG: Remove unused global gen_opc_ arrays Evgeny Voevodin
@ 2012-11-26  4:19 ` Evgeny Voevodin
  2012-12-04  4:49   ` Evgeny Voevodin
  5 siblings, 1 reply; 9+ messages in thread
From: Evgeny Voevodin @ 2012-11-26  4:19 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexander Graf, blauwirbel, kyungmin.park, Paul Brook,
	edgar.iglesias, aurelien, rth

On 11/21/2012 11:43 AM, Evgeny Voevodin wrote:
> This set of patches moves global variables to tcg_ctx:
> gen_opc_instr
> gen_opparam_icount
> gen_opc_pc
>
> Build tested for all targets.
> Execution tested on Exynos4210 target.
>
> After this patchset was aplied,
> I noticed no speed-up or slow-down of code generation.
>
> Here is the test procedure:
> 1. Boot Linux Kernel 5 times.
> 2. For each iteration wait while "JIT cycles" is stable for ~10 seconds
> 3. Write down the "cycles/op"
>
> Here are the results (tested on gcc-4.6):
>
> Before clean-up:
> min: 655.5
> max: 659.3
> avg: 657.2
> standard deviation: ~2 ~= 0.4%
>
> Average cycles/op = 657 +- 2
>
>
>
> After clean-up:
> min: 654.6
> max: 657.1
> avg: 655.5
> standard deviation: ~1 ~= 0.2%
>
> Average cycles/op = 656 +- 1
>
> Evgeny Voevodin (5):
>    tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
>    TCG: Use gen_opc_pc from context instead of global variable.
>    TCG: Use gen_opc_icount from context instead of global variable.
>    TCG: Use gen_opc_instr_start from context instead of global variable.
>    TCG: Remove unused global gen_opc_ arrays.
>
>   exec-all.h                    |    4 ----
>   target-alpha/translate.c      |   12 ++++++------
>   target-arm/translate.c        |   12 ++++++------
>   target-cris/translate.c       |   14 +++++++-------
>   target-i386/translate.c       |   19 ++++++++++---------
>   target-lm32/translate.c       |   12 ++++++------
>   target-m68k/translate.c       |   12 ++++++------
>   target-microblaze/translate.c |   12 ++++++------
>   target-mips/translate.c       |   12 ++++++------
>   target-openrisc/translate.c   |   12 ++++++------
>   target-ppc/translate.c        |   12 ++++++------
>   target-s390x/translate.c      |   12 ++++++------
>   target-sh4/translate.c        |   12 ++++++------
>   target-sparc/translate.c      |   12 ++++++------
>   target-unicore32/translate.c  |   12 ++++++------
>   target-xtensa/translate.c     |   10 +++++-----
>   tcg/tcg.h                     |    3 +++
>   translate-all.c               |    9 +++------
>   18 files changed, 100 insertions(+), 103 deletions(-)
>

Ping?

+CC: Alexander Graf <agraf@suse.de>; Paul Brook <paul@codesourcery.com>

-- 
Kind regards,
Evgeny Voevodin,
Technical Leader,
Mobile Group,
Samsung Moscow Research Centre,
e-mail: e.voevodin@samsung.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up
  2012-11-26  4:19 ` [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
@ 2012-12-04  4:49   ` Evgeny Voevodin
  2012-12-08 17:52     ` Blue Swirl
  0 siblings, 1 reply; 9+ messages in thread
From: Evgeny Voevodin @ 2012-12-04  4:49 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alexander Graf, blauwirbel, kyungmin.park, av1474, Paul Brook,
	edgar.iglesias, aurelien, rth

On 11/26/2012 08:19 AM, Evgeny Voevodin wrote:
> On 11/21/2012 11:43 AM, Evgeny Voevodin wrote:
>> This set of patches moves global variables to tcg_ctx:
>> gen_opc_instr
>> gen_opparam_icount
>> gen_opc_pc
>>
>> Build tested for all targets.
>> Execution tested on Exynos4210 target.
>>
>> After this patchset was aplied,
>> I noticed no speed-up or slow-down of code generation.
>>
>> Here is the test procedure:
>> 1. Boot Linux Kernel 5 times.
>> 2. For each iteration wait while "JIT cycles" is stable for ~10 seconds
>> 3. Write down the "cycles/op"
>>
>> Here are the results (tested on gcc-4.6):
>>
>> Before clean-up:
>> min: 655.5
>> max: 659.3
>> avg: 657.2
>> standard deviation: ~2 ~= 0.4%
>>
>> Average cycles/op = 657 +- 2
>>
>>
>>
>> After clean-up:
>> min: 654.6
>> max: 657.1
>> avg: 655.5
>> standard deviation: ~1 ~= 0.2%
>>
>> Average cycles/op = 656 +- 1
>>
>> Evgeny Voevodin (5):
>>    tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
>>    TCG: Use gen_opc_pc from context instead of global variable.
>>    TCG: Use gen_opc_icount from context instead of global variable.
>>    TCG: Use gen_opc_instr_start from context instead of global variable.
>>    TCG: Remove unused global gen_opc_ arrays.
>>
>>   exec-all.h                    |    4 ----
>>   target-alpha/translate.c      |   12 ++++++------
>>   target-arm/translate.c        |   12 ++++++------
>>   target-cris/translate.c       |   14 +++++++-------
>>   target-i386/translate.c       |   19 ++++++++++---------
>>   target-lm32/translate.c       |   12 ++++++------
>>   target-m68k/translate.c       |   12 ++++++------
>>   target-microblaze/translate.c |   12 ++++++------
>>   target-mips/translate.c       |   12 ++++++------
>>   target-openrisc/translate.c   |   12 ++++++------
>>   target-ppc/translate.c        |   12 ++++++------
>>   target-s390x/translate.c      |   12 ++++++------
>>   target-sh4/translate.c        |   12 ++++++------
>>   target-sparc/translate.c      |   12 ++++++------
>>   target-unicore32/translate.c  |   12 ++++++------
>>   target-xtensa/translate.c     |   10 +++++-----
>>   tcg/tcg.h                     |    3 +++
>>   translate-all.c               |    9 +++------
>>   18 files changed, 100 insertions(+), 103 deletions(-)
>>
>
> Ping?
>
> +CC: Alexander Graf <agraf@suse.de>; Paul Brook <paul@codesourcery.com>
>

Ping??

-- 
Kind regards,
Evgeny Voevodin,
Technical Leader,
Mobile Group,
Samsung Moscow Research Centre,
e-mail: e.voevodin@samsung.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up
  2012-12-04  4:49   ` Evgeny Voevodin
@ 2012-12-08 17:52     ` Blue Swirl
  0 siblings, 0 replies; 9+ messages in thread
From: Blue Swirl @ 2012-12-08 17:52 UTC (permalink / raw)
  To: Evgeny Voevodin
  Cc: qemu-devel, Alexander Graf, kyungmin.park, av1474, Paul Brook,
	edgar.iglesias, aurelien, rth

Thanks, applied all.

On Tue, Dec 4, 2012 at 4:49 AM, Evgeny Voevodin <e.voevodin@samsung.com> wrote:
> On 11/26/2012 08:19 AM, Evgeny Voevodin wrote:
>>
>> On 11/21/2012 11:43 AM, Evgeny Voevodin wrote:
>>>
>>> This set of patches moves global variables to tcg_ctx:
>>> gen_opc_instr
>>> gen_opparam_icount
>>> gen_opc_pc
>>>
>>> Build tested for all targets.
>>> Execution tested on Exynos4210 target.
>>>
>>> After this patchset was aplied,
>>> I noticed no speed-up or slow-down of code generation.
>>>
>>> Here is the test procedure:
>>> 1. Boot Linux Kernel 5 times.
>>> 2. For each iteration wait while "JIT cycles" is stable for ~10 seconds
>>> 3. Write down the "cycles/op"
>>>
>>> Here are the results (tested on gcc-4.6):
>>>
>>> Before clean-up:
>>> min: 655.5
>>> max: 659.3
>>> avg: 657.2
>>> standard deviation: ~2 ~= 0.4%
>>>
>>> Average cycles/op = 657 +- 2
>>>
>>>
>>>
>>> After clean-up:
>>> min: 654.6
>>> max: 657.1
>>> avg: 655.5
>>> standard deviation: ~1 ~= 0.2%
>>>
>>> Average cycles/op = 656 +- 1
>>>
>>> Evgeny Voevodin (5):
>>>    tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
>>>    TCG: Use gen_opc_pc from context instead of global variable.
>>>    TCG: Use gen_opc_icount from context instead of global variable.
>>>    TCG: Use gen_opc_instr_start from context instead of global variable.
>>>    TCG: Remove unused global gen_opc_ arrays.
>>>
>>>   exec-all.h                    |    4 ----
>>>   target-alpha/translate.c      |   12 ++++++------
>>>   target-arm/translate.c        |   12 ++++++------
>>>   target-cris/translate.c       |   14 +++++++-------
>>>   target-i386/translate.c       |   19 ++++++++++---------
>>>   target-lm32/translate.c       |   12 ++++++------
>>>   target-m68k/translate.c       |   12 ++++++------
>>>   target-microblaze/translate.c |   12 ++++++------
>>>   target-mips/translate.c       |   12 ++++++------
>>>   target-openrisc/translate.c   |   12 ++++++------
>>>   target-ppc/translate.c        |   12 ++++++------
>>>   target-s390x/translate.c      |   12 ++++++------
>>>   target-sh4/translate.c        |   12 ++++++------
>>>   target-sparc/translate.c      |   12 ++++++------
>>>   target-unicore32/translate.c  |   12 ++++++------
>>>   target-xtensa/translate.c     |   10 +++++-----
>>>   tcg/tcg.h                     |    3 +++
>>>   translate-all.c               |    9 +++------
>>>   18 files changed, 100 insertions(+), 103 deletions(-)
>>>
>>
>> Ping?
>>
>> +CC: Alexander Graf <agraf@suse.de>; Paul Brook <paul@codesourcery.com>
>>
>
> Ping??
>
> --
> Kind regards,
> Evgeny Voevodin,
> Technical Leader,
> Mobile Group,
> Samsung Moscow Research Centre,
> e-mail: e.voevodin@samsung.com
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-12-08 17:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-21  7:43 [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
2012-11-21  7:43 ` [Qemu-devel] [PATCH 1/5] tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext Evgeny Voevodin
2012-11-21  7:43 ` [Qemu-devel] [PATCH 2/5] TCG: Use gen_opc_pc from context instead of global variable Evgeny Voevodin
2012-11-21  7:43 ` [Qemu-devel] [PATCH 3/5] TCG: Use gen_opc_icount " Evgeny Voevodin
2012-11-21  7:43 ` [Qemu-devel] [PATCH 4/5] TCG: Use gen_opc_instr_start " Evgeny Voevodin
2012-11-21  7:43 ` [Qemu-devel] [PATCH 5/5] TCG: Remove unused global gen_opc_ arrays Evgeny Voevodin
2012-11-26  4:19 ` [Qemu-devel] [PATCH 0/5] TCG global gen_opc_ arrays clean-up Evgeny Voevodin
2012-12-04  4:49   ` Evgeny Voevodin
2012-12-08 17:52     ` Blue Swirl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.