TCG global variables clean-up
PATCH v2 7/7 TCG: Remove unused global variables
In reply to Evgeny VoevodinFrom: Evgeny <[email protected]>
--- tcg/tcg.c | 4 ---- tcg/tcg.h | 4 ---- translate-all.c | 3 --- 3 files changed, 11 deletions(-)
tcg/tcg.c +0 -4
@@ -96,10 +96,6 @@ const size_t tcg_op_defs_max = ARRAY_SIZE(tcg_op_defs);static TCGRegSet tcg_target_available_regs[2 ];static TCGRegSet tcg_target_call_clobber_regs; -/* XXX: move that inside the context */ -uint16_t *gen_opc_ptr; -TCGArg *gen_opparam_ptr; -static inline void tcg_out8 (TCGContext *s,uint8_t v) { *s->code_ptr++ = v;
tcg/tcg.h +0 -4
@@ -432,10 +432,6 @@ struct TCGContext {extern TCGContext tcg_ctx;extern TCGContext *tcg_cur_ctx; -extern uint16_t *gen_opc_ptr; -extern TCGArg *gen_opparam_ptr; -extern uint16_t gen_opc_buf[]; -extern TCGArg gen_opparam_buf[];/* pool based memory allocation */
translate-all.c +0 -3
@@ -34,9 +34,6 @@TCGContext tcg_ctx;TCGContext *tcg_cur_ctx = &tcg_ctx; -uint16_t gen_opc_buf[OPC_BUF_SIZE ]; -TCGArg gen_opparam_buf[OPPARAM_BUF_SIZE ]; -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 ];
Signature · 1 line
1.7.9.5
PATCH v2 1/7 tcg/tcg.h: Duplicate global TCG variables in TCGContext
In reply to Evgeny VoevodinFrom: Evgeny <[email protected]>
--- tcg/tcg.h | 6 ++++++ 1 file changed, 6 insertions(+)
tcg/tcg.h +6 -0
@@ -422,6 +422,12 @@ struct TCGContext {int temps_in_use;int goto_tb_issue_mask;#endif + +uint16_t gen_opc_buf[OPC_BUF_SIZE ]; +TCGArg gen_opparam_buf[OPPARAM_BUF_SIZE ]; + +uint16_t *gen_opc_ptr; +TCGArg *gen_opparam_ptr; };extern TCGContext tcg_ctx;
Signature · 1 line
1.7.9.5
PATCH v2 2/7 translate-all.c: Introduce TCGContext *tcg_cur_ctx
In reply to Evgeny VoevodinWe will use this pointer from functions where we don't have an interface to pass tcg_ctx as a parameter.
--- tcg/tcg.h | 1 + translate-all.c | 1 + 2 files changed, 2 insertions(+)
tcg/tcg.h +1 -0
@@ -431,6 +431,7 @@ struct TCGContext { };extern TCGContext tcg_ctx; +extern TCGContext *tcg_cur_ctx;extern uint16_t *gen_opc_ptr;extern TCGArg *gen_opparam_ptr;extern uint16_t gen_opc_buf[];
translate-all.c +1 -0
@@ -32,6 +32,7 @@/* code generation context */ TCGContext tcg_ctx; +TCGContext *tcg_cur_ctx = &tcg_ctx;uint16_t gen_opc_buf[OPC_BUF_SIZE ];TCGArg gen_opparam_buf[OPPARAM_BUF_SIZE ];
Signature · 1 line
1.7.9.5
PATCH v2 6/7 TCG: Use gen_opparam_buf from context instead of global variable.
In reply to Evgeny Voevodin--- tcg/tcg.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tcg/tcg.c +6 -5
@@ -298,7 +298,7 @@ void tcg_func_start(TCGContext *s)#endif s->gen_opc_ptr = s->gen_opc_buf; - s->gen_opparam_ptr = gen_opparam_buf; + s->gen_opparam_ptr = s->gen_opparam_buf; }static inline void tcg_temp_alloc (TCGContext *s,int n)
@@ -885,7 +885,7 @@ void tcg_dump_ops(TCGContext *s) first_insn =1 ; opc_ptr = s->gen_opc_buf; - args = gen_opparam_buf; + args = s->gen_opparam_buf;while (opc_ptr < s->gen_opc_ptr) { c = *opc_ptr++; def = &tcg_op_defs[c];
@@ -1409,8 +1409,9 @@ static void tcg_liveness_analysis(TCGContext *s) op_index--; } -if (args != gen_opparam_buf) +if (args != s->gen_opparam_buf) {tcg_abort (); + } }#else /* dummy liveness analysis */
@@ -2104,7 +2105,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,#ifdef USE_TCG_OPTIMIZATIONS s->gen_opparam_ptr = -tcg_optimize (s, s->gen_opc_ptr, gen_opparam_buf, tcg_op_defs); +tcg_optimize (s, s->gen_opc_ptr, s->gen_opparam_buf, tcg_op_defs);#endif #ifdef CONFIG_PROFILER
@@ -2131,7 +2132,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, s->code_buf = gen_code_buf; s->code_ptr = gen_code_buf; - args = gen_opparam_buf; + args = s->gen_opparam_buf; op_index =0 ;for (;;) {
Signature · 1 line
1.7.9.5
v2 cover TCG global variables clean-up
This set of patches moves global variables to tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_buf
Build tested for all targets.
Execution tested on ARM.
I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:v1->v2:
Introduced TCGContext *tcg_cur_ctx global to use in those places where we don't have an interface to pass pointer to tcg_ctx.
Code style clean-up
Evgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variables
Evgeny Voevodin (5):
translate-all.c: Introduce TCGContext *tcg_cur_ctx
TCG: Use gen_opc_ptr from context instead of global variable.
TCG: Use gen_opparam_ptr from context instead of global variable.
TCG: Use gen_opc_buf from context instead of global variable.
TCG: Use gen_opparam_buf from context instead of global variable.
gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)
Signature · 1 line
1.7.9.5
PATCH v2 4/7 TCG: Use gen_opparam_ptr from context instead of global variable.
--- gen-icount.h | 2 +- tcg/tcg-op.h | 254 +++++++++++++++++++++++++++++----------------------------- tcg/tcg.c | 36 ++++----- 3 files changed, 146 insertions(+), 146 deletions(-)
gen-icount.h +1 -1
@@ -16,7 +16,7 @@ static inline void gen_icount_start(void) count =tcg_temp_local_new_i32 (); tcg_gen_ld_i32(count, cpu_env, offsetof(CPUArchState, icount_decr.u32));/* This is a horrid hack to allow fixing up the value later. */ - icount_arg = gen_opparam_ptr +1 ; + icount_arg = tcg_cur_ctx->gen_opparam_ptr +1 ;tcg_gen_subi_i32 (count, count,0xdeadbeef );tcg_gen_brcondi_i32 (TCG_COND_LT , count,0 , icount_label);
tcg/tcg-op.h +127 -127
451 lines not on this page · raw message
tcg/tcg.c +18 -18
@@ -298,7 +298,7 @@ void tcg_func_start(TCGContext *s)#endif s->gen_opc_ptr = gen_opc_buf; - gen_opparam_ptr = gen_opparam_buf; + s->gen_opparam_ptr = gen_opparam_buf; }static inline void tcg_temp_alloc (TCGContext *s,int n)
@@ -634,22 +634,22 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,#endif /* TCG_TARGET_EXTEND_ARGS */ *s->gen_opc_ptr++ = INDEX_op_call; - nparam = gen_opparam_ptr++; + nparam = s->gen_opparam_ptr++;if (ret !=TCG_CALL_DUMMY_ARG ) {#if TCG_TARGET_REG_BITS <64 if (sizemask &1 ) {#ifdef TCG_TARGET_WORDS_BIGENDIAN - *gen_opparam_ptr++ = ret +1 ; - *gen_opparam_ptr++ = ret; + *s->gen_opparam_ptr++ = ret +1 ; + *s->gen_opparam_ptr++ = ret;#else - *gen_opparam_ptr++ = ret; - *gen_opparam_ptr++ = ret +1 ; + *s->gen_opparam_ptr++ = ret; + *s->gen_opparam_ptr++ = ret +1 ;#endif nb_rets =2 ; } else#endif { - *gen_opparam_ptr++ = ret; + *s->gen_opparam_ptr++ = ret; nb_rets =1 ; } }else {
@@ -663,7 +663,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,#ifdef TCG_TARGET_CALL_ALIGN_ARGS /* some targets want aligned 64 bit args */ if (real_args &1 ) { - *gen_opparam_ptr++ =TCG_CALL_DUMMY_ARG ; + *s->gen_opparam_ptr++ =TCG_CALL_DUMMY_ARG ; real_args++; }#endif
@@ -678,28 +678,28 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,have to get more complicated to differentiate between stack arguments and register arguments. */ #if defined(TCG_TARGET_WORDS_BIGENDIAN ) != defined(TCG_TARGET_STACK_GROWSUP ) - *gen_opparam_ptr++ = args[i] +1 ; - *gen_opparam_ptr++ = args[i]; + *s->gen_opparam_ptr++ = args[i] +1 ; + *s->gen_opparam_ptr++ = args[i];#else - *gen_opparam_ptr++ = args[i]; - *gen_opparam_ptr++ = args[i] +1 ; + *s->gen_opparam_ptr++ = args[i]; + *s->gen_opparam_ptr++ = args[i] +1 ;#endif real_args +=2 ;continue ; }#endif /* TCG_TARGET_REG_BITS < 64 */ - *gen_opparam_ptr++ = args[i]; + *s->gen_opparam_ptr++ = args[i]; real_args++; } - *gen_opparam_ptr++ =GET_TCGV_PTR (func); + *s->gen_opparam_ptr++ =GET_TCGV_PTR (func); - *gen_opparam_ptr++ = flags; + *s->gen_opparam_ptr++ = flags; *nparam = (nb_rets <<16 ) | (real_args +1 );/* total parameters, needed to go backward in the instruction stream */ - *gen_opparam_ptr++ =1 + nb_rets + real_args +3 ; + *s->gen_opparam_ptr++ =1 + nb_rets + real_args +3 ;#if defined(TCG_TARGET_EXTEND_ARGS ) &&TCG_TARGET_REG_BITS ==64 for (i =0 ; i < nargs; ++i) {
@@ -1229,7 +1229,7 @@ static void tcg_liveness_analysis(TCGContext *s) dead_temps =tcg_malloc (s->nb_temps);memset (dead_temps,1 , s->nb_temps); - args = gen_opparam_ptr; + args = s->gen_opparam_ptr; op_index = nb_ops -1 ;while (op_index >=0 ) { op = gen_opc_buf[op_index];
@@ -2103,7 +2103,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,#endif #ifdef USE_TCG_OPTIMIZATIONS - gen_opparam_ptr = + s->gen_opparam_ptr =tcg_optimize (s, s->gen_opc_ptr, gen_opparam_buf, tcg_op_defs);#endif
Signature · 1 line
1.7.9.5
PATCH v2 3/7 TCG: Use gen_opc_ptr from context instead of global variable.
In reply to Evgeny Voevodin--- target-alpha/translate.c | 8 ++--- target-arm/translate.c | 8 ++--- target-cris/translate.c | 10 +++--- target-i386/translate.c | 8 ++--- target-lm32/translate.c | 10 +++--- target-m68k/translate.c | 8 ++--- target-microblaze/translate.c | 10 +++--- target-mips/translate.c | 9 +++--- target-openrisc/translate.c | 10 +++--- target-ppc/translate.c | 9 +++--- target-s390x/translate.c | 9 +++--- target-sh4/translate.c | 8 ++--- target-sparc/translate.c | 8 ++--- target-unicore32/translate.c | 8 ++--- target-xtensa/translate.c | 6 ++-- tcg/tcg-op.h | 70 ++++++++++++++++++++--------------------- tcg/tcg.c | 16 +++++----- 17 files changed, 109 insertions(+), 106 deletions(-)
target-alpha/translate.c +4 -4
@@ -3406,7 +3406,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env, } }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3432,7 +3432,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,or exhaust instruction count, stop generation. */ if (ret ==NO_EXIT && ((ctx.pc & (TARGET_PAGE_SIZE -1 )) ==0 - || gen_opc_ptr >= gen_opc_end + || tcg_cur_ctx->gen_opc_ptr >= gen_opc_end || num_insns >= max_insns || singlestep || env->singlestep_enabled)) {
@@ -3463,9 +3463,9 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env, }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-arm/translate.c +4 -4
@@ -9825,7 +9825,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, } }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -9872,7 +9872,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,* Also stop translation when a page boundary is reached. This * ensures prefetch aborts occur at the right place. */ num_insns ++; - } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && + } while (!dc->is_jmp && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start &&
@@ -9953,7 +9953,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, done_generating:gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;#ifdef DEBUG_DISAS if (qemu_loglevel_mask (CPU_LOG_TB_IN_ASM )) {
@@ -9965,7 +9965,7 @@ done_generating: }#endif if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-cris/translate.c +5 -5
@@ -3266,7 +3266,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,check_breakpoint (env, dc);if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3348,7 +3348,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,if (!(tb->pc &1 ) && env->singlestep_enabled)break ; }while (!dc->is_jmp && !dc->cpustate_changed - && gen_opc_ptr < gen_opc_end + && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns);
@@ -3399,9 +3399,9 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb, } }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
@@ -3416,7 +3416,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,log_target_disas (pc_start, dc->pc - pc_start, dc->env->pregs[PR_VR ]);qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); }#endif #endif
target-i386/translate.c +4 -4
@@ -7980,7 +7980,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, } }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -8011,7 +8011,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,break ; }/* if too long translation, stop generation too */ -if (gen_opc_ptr >= gen_opc_end || +if (tcg_cur_ctx->gen_opc_ptr >= gen_opc_end || (pc_ptr - pc_start) >= (TARGET_PAGE_SIZE -32 ) || num_insns >= max_insns) {gen_jmp_im (pc_ptr - dc->cs_base);
@@ -8027,10 +8027,10 @@ static inline void gen_intermediate_code_internal(CPUX86State *env,if (tb->cflags &CF_LAST_IO )gen_io_end ();gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;/* we don't forget to fill the last values */ if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-lm32/translate.c +5 -5
@@ -1047,7 +1047,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,check_breakpoint (env, dc);if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -1071,7 +1071,7 @@ static void gen_intermediate_code_internal(CPULM32State *env, num_insns++; }while (!dc->is_jmp - && gen_opc_ptr < gen_opc_end + && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && (dc->pc < next_page_start)
@@ -1105,9 +1105,9 @@ static void gen_intermediate_code_internal(CPULM32State *env, }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
@@ -1122,7 +1122,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,qemu_log ("\n" );log_target_disas (pc_start, dc->pc - pc_start,0 );qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); }#endif }
target-m68k/translate.c +4 -4
@@ -3015,7 +3015,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,break ; }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3030,7 +3030,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb, dc->insn_pc = dc->pc;disas_m68k_insn (env, dc); num_insns++; - } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && + } while (!dc->is_jmp && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && (pc_offset) < (TARGET_PAGE_SIZE - 32) &&
@@ -3064,7 +3064,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb, } }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;#ifdef DEBUG_DISAS if (qemu_loglevel_mask (CPU_LOG_TB_IN_ASM )) {
@@ -3075,7 +3075,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb, }#endif if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-microblaze/translate.c +5 -5
@@ -1784,7 +1784,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,check_breakpoint (env, dc);if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -1846,7 +1846,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,if (env->singlestep_enabled)break ; }while (!dc->is_jmp && !dc->cpustate_changed - && gen_opc_ptr < gen_opc_end + && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !singlestep && (dc->pc < next_page_start) && num_insns < max_insns);
@@ -1897,9 +1897,9 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb, } }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
@@ -1916,7 +1916,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,log_target_disas (pc_start, dc->pc - pc_start,0 );#endif qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); }#endif #endif
target-mips/translate.c +5 -4
@@ -12845,7 +12845,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb, }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -12892,8 +12892,9 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,if ((ctx.pc & (TARGET_PAGE_SIZE -1 )) ==0 )break ; -if (gen_opc_ptr >= gen_opc_end) +if (tcg_cur_ctx->gen_opc_ptr >= gen_opc_end) {break ; + }if (num_insns >= max_insns)break ;
@@ -12925,9 +12926,9 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb, } done_generating:gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-openrisc/translate.c +5 -5
@@ -1703,7 +1703,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, do { check_breakpoint(cpu, dc); if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; if (k < j) { k++; while (k < j) {
@@ -1744,7 +1744,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, } } }while (!dc->is_jmp - && gen_opc_ptr < gen_opc_end + && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !cpu->env.singlestep_enabled && !singlestep && (dc->pc < next_page_start)
@@ -1782,9 +1782,9 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; k++;while (k <= j) { gen_opc_instr_start[k++] =0 ;
@@ -1799,7 +1799,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,qemu_log ("\n" );log_target_disas (pc_start, dc->pc - pc_start,0 );qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); }#endif }
target-ppc/translate.c +5 -4
@@ -9657,7 +9657,8 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,gen_icount_start ();/* Set env in case of segfault during code fetch */ -while (ctx.exception ==POWERPC_EXCP_NONE && gen_opc_ptr < gen_opc_end) { +while (ctx.exception ==POWERPC_EXCP_NONE + && tcg_cur_ctx->gen_opc_ptr < gen_opc_end) {if (unlikely (!QTAILQ_EMPTY (&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) {if (bp->pc == ctx.nip) {
@@ -9667,7 +9668,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env, } }if (unlikely (search_pc)) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -9767,9 +9768,9 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,tcg_gen_exit_tb (0 ); }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (unlikely (search_pc)) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-s390x/translate.c +5 -4
@@ -5156,7 +5156,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, } }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -5182,7 +5182,8 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,if (env->singlestep_enabled) {gen_debug (&dc); } - }while (!dc.is_jmp && gen_opc_ptr < gen_opc_end && dc.pc < next_page_start + }while (!dc.is_jmp && tcg_cur_ctx->gen_opc_ptr < gen_opc_end + && dc.pc < next_page_start && num_insns < max_insns && !env->singlestep_enabled && !singlestep);
@@ -5206,9 +5207,9 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,tcg_gen_exit_tb (0 ); }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
target-sh4/translate.c +4 -4
@@ -1986,7 +1986,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,if (max_insns ==0 ) max_insns =CF_COUNT_MASK ;gen_icount_start (); -while (ctx.bstate ==BS_NONE && gen_opc_ptr < gen_opc_end) { +while (ctx.bstate ==BS_NONE && tcg_cur_ctx->gen_opc_ptr < gen_opc_end) {if (unlikely (!QTAILQ_EMPTY (&env->breakpoints))) { QTAILQ_FOREACH(bp, &env->breakpoints, entry) {if (ctx.pc == bp->pc) {
@@ -1999,7 +1999,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb, } }if (search_pc) { - i = gen_opc_ptr - gen_opc_buf; + i = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (ii < i) { ii++;while (ii < i)
@@ -2056,9 +2056,9 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb, }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - i = gen_opc_ptr - gen_opc_buf; + i = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; ii++;while (ii <= i) gen_opc_instr_start[ii++] =0 ;
target-sparc/translate.c +4 -4
@@ -5279,7 +5279,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb, }if (spc) {qemu_log ("Search PC...\n" ); - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -5312,7 +5312,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,if (dc->singlestep) {break ; } - }while ((gen_opc_ptr < gen_opc_end) && + }while ((tcg_cur_ctx->gen_opc_ptr < gen_opc_end) && (dc->pc - pc_start) < (TARGET_PAGE_SIZE -32 ) && num_insns < max_insns);
@@ -5334,9 +5334,9 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb, } }gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (spc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-unicore32/translate.c +4 -4
@@ -1999,7 +1999,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, } }if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -2031,7 +2031,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env,* Also stop translation when a page boundary is reached. This * ensures prefetch aborts occur at the right place. */ num_insns++; - } while (!dc->is_jmp && gen_opc_ptr < gen_opc_end && + } while (!dc->is_jmp && tcg_cur_ctx->gen_opc_ptr < gen_opc_end && !env->singlestep_enabled && !singlestep && dc->pc < next_page_start &&
@@ -2103,7 +2103,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, done_generating:gen_icount_end (tb, num_insns); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;#ifdef DEBUG_DISAS if (qemu_loglevel_mask (CPU_LOG_TB_IN_ASM )) {
@@ -2114,7 +2114,7 @@ done_generating: }#endif if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
target-xtensa/translate.c +3 -3
@@ -2893,7 +2893,7 @@ static void gen_intermediate_code_internal(check_breakpoint (env, &dc);if (search_pc) { - j = gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -2944,7 +2944,7 @@ static void gen_intermediate_code_internal( }while (dc.is_jmp ==DISAS_NEXT && insn_count < max_insns && dc.pc < next_page_start && - gen_opc_ptr < gen_opc_end); + tcg_cur_ctx->gen_opc_ptr < gen_opc_end);reset_litbase (&dc);reset_sar_tracker (&dc);
@@ -2960,7 +2960,7 @@ static void gen_intermediate_code_internal(gen_jumpi (&dc, dc.pc,0 ); }gen_icount_end (tb, insn_count); - *gen_opc_ptr = INDEX_op_end; + *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (!search_pc) { tb->size = dc.pc - pc_start;
tcg/tcg-op.h +35 -35
275 lines not on this page · raw message
tcg/tcg.c +8 -8
@@ -297,7 +297,7 @@ void tcg_func_start(TCGContext *s) s->goto_tb_issue_mask =0 ;#endif - gen_opc_ptr = gen_opc_buf; + s->gen_opc_ptr = gen_opc_buf; gen_opparam_ptr = gen_opparam_buf; }
@@ -633,7 +633,7 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags, }#endif /* TCG_TARGET_EXTEND_ARGS */ - *gen_opc_ptr++ = INDEX_op_call; + *s->gen_opc_ptr++ = INDEX_op_call; nparam = gen_opparam_ptr++;if (ret !=TCG_CALL_DUMMY_ARG ) {#if TCG_TARGET_REG_BITS <64
@@ -886,7 +886,7 @@ void tcg_dump_ops(TCGContext *s) first_insn =1 ; opc_ptr = gen_opc_buf; args = gen_opparam_buf; -while (opc_ptr < gen_opc_ptr) { +while (opc_ptr < s->gen_opc_ptr) { c = *opc_ptr++; def = &tcg_op_defs[c];if (c == INDEX_op_debug_insn_start) {
@@ -1220,9 +1220,9 @@ static void tcg_liveness_analysis(TCGContext *s)uint8_t *dead_temps;unsigned int dead_args; - gen_opc_ptr++;/* skip end */ + s->gen_opc_ptr++;/* skip end */ - nb_ops = gen_opc_ptr - gen_opc_buf; + nb_ops = s->gen_opc_ptr - gen_opc_buf; s->op_dead_args =tcg_malloc (nb_ops *sizeof (uint16_t ));
@@ -1417,7 +1417,7 @@ static void tcg_liveness_analysis(TCGContext *s)static void tcg_liveness_analysis (TCGContext *s) {int nb_ops; - nb_ops = gen_opc_ptr - gen_opc_buf; + nb_ops = s->gen_opc_ptr - gen_opc_buf; s->op_dead_args =tcg_malloc (nb_ops *sizeof (uint16_t ));memset (s->op_dead_args,0 , nb_ops *sizeof (uint16_t ));
@@ -2104,7 +2104,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf,#ifdef USE_TCG_OPTIMIZATIONS gen_opparam_ptr = -tcg_optimize (s, gen_opc_ptr, gen_opparam_buf, tcg_op_defs); +tcg_optimize (s, s->gen_opc_ptr, gen_opparam_buf, tcg_op_defs);#endif #ifdef CONFIG_PROFILER
@@ -2219,7 +2219,7 @@ int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)#ifdef CONFIG_PROFILER {int n; - n = (gen_opc_ptr - gen_opc_buf); + n = (s->gen_opc_ptr - gen_opc_buf); s->op_count += n;if (n > s->op_count_max) s->op_count_max = n;
Signature · 1 line
1.7.9.5
PATCH v2 5/7 TCG: Use gen_opc_buf from context instead of global variable.
In reply to Evgeny Voevodin--- target-alpha/translate.c | 6 ++-- target-arm/translate.c | 6 ++-- target-cris/translate.c | 9 +++--- target-i386/translate.c | 6 ++-- target-lm32/translate.c | 9 +++--- target-m68k/translate.c | 6 ++-- target-microblaze/translate.c | 9 +++--- target-mips/translate.c | 6 ++-- target-openrisc/translate.c | 9 +++--- 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 +-- tcg/optimize.c | 62 ++++++++++++++++++++--------------------- tcg/tcg.c | 30 ++++++++++---------- 17 files changed, 98 insertions(+), 94 deletions(-)
target-alpha/translate.c +3 -3
@@ -3373,7 +3373,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,int max_insns; pc_start = tb->pc; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; ctx.tb = tb; ctx.env = env;
@@ -3406,7 +3406,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env, } }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3465,7 +3465,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-arm/translate.c +3 -3
@@ -9718,7 +9718,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->pc = pc_start;
@@ -9825,7 +9825,7 @@ static inline void gen_intermediate_code_internal(CPUARMState *env, } }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -9965,7 +9965,7 @@ done_generating: }#endif if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-cris/translate.c +5 -4
@@ -3202,7 +3202,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb, dc->env = env; dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->ppc = pc_start;
@@ -3266,7 +3266,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,check_breakpoint (env, dc);if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3401,7 +3401,7 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
@@ -3416,7 +3416,8 @@ gen_intermediate_code_internal(CPUCRISState *env, TranslationBlock *tb,log_target_disas (pc_start, dc->pc - pc_start, dc->env->pregs[PR_VR ]);qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - + tcg_cur_ctx->gen_opc_buf); }#endif #endif
target-i386/translate.c +3 -3
@@ -7958,7 +7958,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, cpu_ptr0 =tcg_temp_new_ptr (); cpu_ptr1 =tcg_temp_new_ptr (); - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; pc_ptr = pc_start;
@@ -7980,7 +7980,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, } }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -8030,7 +8030,7 @@ static inline void gen_intermediate_code_internal(CPUX86State *env, *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;/* we don't forget to fill the last values */ if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-lm32/translate.c +5 -4
@@ -1018,7 +1018,7 @@ static void gen_intermediate_code_internal(CPULM32State *env, dc->env = env; dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->pc = pc_start;
@@ -1047,7 +1047,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,check_breakpoint (env, dc);if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -1107,7 +1107,7 @@ static void gen_intermediate_code_internal(CPULM32State *env,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
@@ -1122,7 +1122,8 @@ static void gen_intermediate_code_internal(CPULM32State *env,qemu_log ("\n" );log_target_disas (pc_start, dc->pc - pc_start,0 );qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - + tcg_cur_ctx->gen_opc_buf); }#endif }
target-m68k/translate.c +3 -3
@@ -2982,7 +2982,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb, dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->env = env; dc->is_jmp =DISAS_NEXT ;
@@ -3015,7 +3015,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb,break ; }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -3075,7 +3075,7 @@ gen_intermediate_code_internal(CPUM68KState *env, TranslationBlock *tb, }#endif if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-microblaze/translate.c +5 -4
@@ -1741,7 +1741,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb, dc->tb = tb; org_flags = dc->synced_flags = dc->tb_flags = tb->flags; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->jmp =0 ;
@@ -1784,7 +1784,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,check_breakpoint (env, dc);if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -1899,7 +1899,7 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
@@ -1916,7 +1916,8 @@ gen_intermediate_code_internal(CPUMBState *env, TranslationBlock *tb,log_target_disas (pc_start, dc->pc - pc_start,0 );#endif qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - + tcg_cur_ctx->gen_opc_buf); }#endif #endif
target-mips/translate.c +3 -3
@@ -12809,7 +12809,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb,qemu_log ("search pc %d\n" , search_pc); pc_start = tb->pc; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; ctx.pc = pc_start; ctx.saved_pc =-1 ; ctx.singlestep_enabled = env->singlestep_enabled;
@@ -12845,7 +12845,7 @@ gen_intermediate_code_internal (CPUMIPSState *env, TranslationBlock *tb, }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -12928,7 +12928,7 @@ done_generating:gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-openrisc/translate.c +5 -4
@@ -1675,7 +1675,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, pc_start = tb->pc; dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->ppc = pc_start; dc->pc = pc_start;
@@ -1703,7 +1703,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu, do { check_breakpoint(cpu, dc); if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; if (k < j) { k++; while (k < j) {
@@ -1784,7 +1784,7 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; k++;while (k <= j) { gen_opc_instr_start[k++] =0 ;
@@ -1799,7 +1799,8 @@ static inline void gen_intermediate_code_internal(OpenRISCCPU *cpu,qemu_log ("\n" );log_target_disas (pc_start, dc->pc - pc_start,0 );qemu_log ("\nisize=%d osize=%td\n" , - dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - gen_opc_buf); + dc->pc - pc_start, tcg_cur_ctx->gen_opc_ptr - + tcg_cur_ctx->gen_opc_buf); }#endif }
target-ppc/translate.c +3 -3
@@ -9617,7 +9617,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,int max_insns; pc_start = tb->pc; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; ctx.nip = pc_start; ctx.tb = tb; ctx.exception =POWERPC_EXCP_NONE ;
@@ -9668,7 +9668,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env, } }if (unlikely (search_pc)) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -9770,7 +9770,7 @@ static inline void gen_intermediate_code_internal(CPUPPCState *env,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (unlikely (search_pc)) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-s390x/translate.c +3 -3
@@ -5134,7 +5134,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, dc.tb = tb; dc.cc_op =CC_OP_DYNAMIC ; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; next_page_start = (pc_start &TARGET_PAGE_MASK ) +TARGET_PAGE_SIZE ;
@@ -5156,7 +5156,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env, } }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -5209,7 +5209,7 @@ static inline void gen_intermediate_code_internal(CPUS390XState *env,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
target-sh4/translate.c +3 -3
@@ -1967,7 +1967,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,int max_insns; pc_start = tb->pc; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; ctx.pc = pc_start; ctx.flags = (uint32_t )tb->flags; ctx.bstate =BS_NONE ;
@@ -1999,7 +1999,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb, } }if (search_pc) { - i = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + i = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (ii < i) { ii++;while (ii < i)
@@ -2058,7 +2058,7 @@ gen_intermediate_code_internal(CPUSH4State * env, TranslationBlock * tb,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (search_pc) { - i = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + i = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; ii++;while (ii <= i) gen_opc_instr_start[ii++] =0 ;
target-sparc/translate.c +3 -3
@@ -5257,7 +5257,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb, dc->fpu_enabled =tb_fpu_enabled (tb->flags); dc->address_mask_32bit =tb_am_enabled (tb->flags); dc->singlestep = (env->singlestep_enabled || singlestep); - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; num_insns =0 ; max_insns = tb->cflags &CF_COUNT_MASK ;
@@ -5279,7 +5279,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb, }if (spc) {qemu_log ("Search PC...\n" ); - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j)
@@ -5336,7 +5336,7 @@ static inline void gen_intermediate_code_internal(TranslationBlock * tb,gen_icount_end (tb, num_insns); *tcg_cur_ctx->gen_opc_ptr = INDEX_op_end;if (spc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) gen_opc_instr_start[lj++] =0 ;
target-unicore32/translate.c +3 -3
@@ -1956,7 +1956,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, dc->tb = tb; - gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; + gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ; dc->is_jmp =DISAS_NEXT ; dc->pc = pc_start;
@@ -1999,7 +1999,7 @@ static inline void gen_intermediate_code_internal(CPUUniCore32State *env, } }if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
@@ -2114,7 +2114,7 @@ done_generating: }#endif if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf; lj++;while (lj <= j) { gen_opc_instr_start[lj++] =0 ;
target-xtensa/translate.c +2 -2
@@ -2849,7 +2849,7 @@ static void gen_intermediate_code_internal(DisasContext dc;int insn_count =0 ;int j, lj =-1 ; -uint16_t *gen_opc_end = gen_opc_buf +OPC_MAX_SIZE ; +uint16_t *gen_opc_end = tcg_cur_ctx->gen_opc_buf +OPC_MAX_SIZE ;int max_insns = tb->cflags &CF_COUNT_MASK ;uint32_t pc_start = tb->pc; uint32_t next_page_start =
@@ -2893,7 +2893,7 @@ static void gen_intermediate_code_internal(check_breakpoint (env, &dc);if (search_pc) { - j = tcg_cur_ctx->gen_opc_ptr - gen_opc_buf; + j = tcg_cur_ctx->gen_opc_ptr - tcg_cur_ctx->gen_opc_buf;if (lj < j) { lj++;while (lj < j) {
tcg/optimize.c +31 -31
202 lines not on this page · raw message
tcg/tcg.c +15 -15
@@ -297,7 +297,7 @@ void tcg_func_start(TCGContext *s) s->goto_tb_issue_mask =0 ;#endif - s->gen_opc_ptr = gen_opc_buf; + s->gen_opc_ptr = s->gen_opc_buf; s->gen_opparam_ptr = gen_opparam_buf; }
@@ -884,7 +884,7 @@ void tcg_dump_ops(TCGContext *s)char buf[128 ]; first_insn =1 ; - opc_ptr = gen_opc_buf; + opc_ptr = s->gen_opc_buf; args = gen_opparam_buf;while (opc_ptr < s->gen_opc_ptr) { c = *opc_ptr++;
@@ -1222,7 +1222,7 @@ static void tcg_liveness_analysis(TCGContext *s) s->gen_opc_ptr++;/* skip end */ - nb_ops = s->gen_opc_ptr - gen_opc_buf; + nb_ops = s->gen_opc_ptr - s->gen_opc_buf; s->op_dead_args =tcg_malloc (nb_ops *sizeof (uint16_t ));
@@ -1232,7 +1232,7 @@ static void tcg_liveness_analysis(TCGContext *s) args = s->gen_opparam_ptr; op_index = nb_ops -1 ;while (op_index >=0 ) { - op = gen_opc_buf[op_index]; + op = s->gen_opc_buf[op_index]; def = &tcg_op_defs[op];switch (op) {case INDEX_op_call:
@@ -1254,7 +1254,7 @@ static void tcg_liveness_analysis(TCGContext *s)if (!dead_temps[arg]) goto do_not_remove_call; } -tcg_set_nop (s, gen_opc_buf + op_index, +tcg_set_nop (s, s->gen_opc_buf + op_index, args -1 , nb_args); }else { do_not_remove_call:
@@ -1323,11 +1323,11 @@ static void tcg_liveness_analysis(TCGContext *s) }else { op = INDEX_op_sub_i32; } - gen_opc_buf[op_index] = op; + s->gen_opc_buf[op_index] = op; args[1 ] = args[2 ]; args[2 ] = args[4 ]; -assert (gen_opc_buf[op_index +1 ] == INDEX_op_nop); -tcg_set_nop (s, gen_opc_buf + op_index +1 , args +3 ,3 ); +assert (s->gen_opc_buf[op_index +1 ] == INDEX_op_nop); +tcg_set_nop (s, s->gen_opc_buf + op_index +1 , args +3 ,3 );/* Fall through and mark the single-word operation live. */ nb_iargs =2 ; nb_oargs =1 ;
@@ -1343,11 +1343,11 @@ static void tcg_liveness_analysis(TCGContext *s)if (dead_temps[args[0 ]]) { goto do_remove; } - gen_opc_buf[op_index] = op = INDEX_op_mul_i32; + s->gen_opc_buf[op_index] = op = INDEX_op_mul_i32; args[1 ] = args[2 ]; args[2 ] = args[3 ]; -assert (gen_opc_buf[op_index +1 ] == INDEX_op_nop); -tcg_set_nop (s, gen_opc_buf + op_index +1 , args +3 ,1 ); +assert (s->gen_opc_buf[op_index +1 ] == INDEX_op_nop); +tcg_set_nop (s, s->gen_opc_buf + op_index +1 , args +3 ,1 );/* Fall through and mark the single-word operation live. */ nb_oargs =1 ; }
@@ -1369,7 +1369,7 @@ static void tcg_liveness_analysis(TCGContext *s) goto do_not_remove; } do_remove: -tcg_set_nop (s, gen_opc_buf + op_index, args, def->nb_args); +tcg_set_nop (s, s->gen_opc_buf + op_index, args, def->nb_args);#ifdef CONFIG_PROFILER s->del_op_count++;#endif
@@ -1417,7 +1417,7 @@ static void tcg_liveness_analysis(TCGContext *s)static void tcg_liveness_analysis (TCGContext *s) {int nb_ops; - nb_ops = s->gen_opc_ptr - gen_opc_buf; + nb_ops = s->gen_opc_ptr - s->gen_opc_buf; s->op_dead_args =tcg_malloc (nb_ops *sizeof (uint16_t ));memset (s->op_dead_args,0 , nb_ops *sizeof (uint16_t ));
@@ -2135,7 +2135,7 @@ static inline int tcg_gen_code_common(TCGContext *s, uint8_t *gen_code_buf, op_index =0 ;for (;;) { - opc = gen_opc_buf[op_index]; + opc = s->gen_opc_buf[op_index];#ifdef CONFIG_PROFILER tcg_table_op_count[opc]++;#endif
@@ -2219,7 +2219,7 @@ int tcg_gen_code(TCGContext *s, uint8_t *gen_code_buf)#ifdef CONFIG_PROFILER {int n; - n = (s->gen_opc_ptr - gen_opc_buf); + n = (s->gen_opc_ptr - s->gen_opc_buf); s->op_count += n;if (n > s->op_count_max) s->op_count_max = n;
Signature · 1 line
1.7.9.5
Quoted 17 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't have an interface to pass pointer totcg_ctx.
Code style clean-up
Quoted 4 lines
Evgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variables
It seems that I cherry-picked commits that were made before I correctly set a user name. Hope I don't need to generate v3 because of that.
Quoted 30 lines
Evgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Re: [Qemu-devel] [PATCH v2 2/7] translate-all.c: Introduce TCGContext *tcg_cur_ctx
In reply to Evgeny VoevodinQuoted 2 lines · Evgeny Voevodin
We will use this pointer from functions where we don't have an interface to pass
tcg_ctxas a parameter.
I don't think this is worthwhile. It'll just make the whole thing slower, passing around unnecessary pointers.
r~
Re: [Qemu-devel] [PATCH v2 2/7] translate-all.c: Introduce TCGContext *tcg_cur_ctx
Quoted 9 lines · Richard Henderson
Quoted 2 lines · Evgeny Voevodin
We will use this pointer from functions where we don't have an interface to pass
tcg_ctxas a parameter.I don't think this is worthwhile. It'll just make the whole thing slower, passing around unnecessary pointers.
r~
1. I didn't noticed any slow-down of kernel boot process. Maybe it's worth to make more tests with self modifying code but I don't think so, because
2. The most intensive usage of tcg_cur_ctx is in tcg/tcg-op.h functions. If we look carefully at them then we will see that there are only few functions for which single excessive dereferencing of a pointer leads to any significant slow-down. These functions are those which make just one or two operations and exit. And we should keep in mind that there is only single dereference of a pointer since it is stored in the register for further operations.
Of course some slow-down should present but I found it negligible (actually I didn't find it at all). If there are some common tests for TCG generation speed I can try to run them and report results.
Also we can specify tcg_cur_ctx as const and in that case I guess that dereferencing of tcg_cur_ctx should not lead to any slow-down.
Also I can drop tcg_cur_ctx and use tcg_ctx.xxx instead as was in the first series.
What about the rest patches?
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Any other comments on the patches?
I didn't get the consensus. Do we need a pointer to tcg context? As I said before, I didn't notice any slow-down with it.
Quoted 51 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't have an interface to pass pointer totcg_ctx.
Code style clean-upEvgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variablesEvgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Quoted 4 lines · Evgeny Voevodin
Any other comments on the patches?
I didn't get the consensus. Do we need a pointer to tcg context? As I said before, I didn't notice any slow-down with it.
Quoted 11 lines
Quoted 10 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Would you like to try to run some benchmark after the kernel booting? Like
Yeongkyoon Lee done with his qemu_ld/qemu_st work [1], EEMBC, nbench , or even SPEC. ;)
Regards,
chenwj
[1] http://lists.gnu.org/archive/html/qemu-devel/2012-10/msg03630.html
Signature · 5 lines
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
Quoted 16 lines · 陳韋任 (Wei-Ren Chen)
Quoted 4 lines · Evgeny Voevodin
Any other comments on the patches?
I didn't get the consensus. Do we need a pointer to tcg context? As I said before, I didn't notice any slow-down with it.Quoted 11 lines
Quoted 10 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Quoted 9 lines
Would you like to try to run some benchmark after the kernel booting? Like
Yeongkyoon Lee done with his qemu_ld/qemu_st work [1], EEMBC, nbench , or even SPEC. ;)Regards,
chenwj[1] http://lists.gnu.org/archive/html/qemu-devel/2012-10/msg03630.html
Sure.
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Here are the results of tests before and after this patch series was applied:
* EEMBC CoreMark (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results: 1148.105626 -> 1161.440186 (+1.16%)
* nbench (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results
. MEMORY INDEX: 1.864 -> 1.862 (-0.11%)
. INTEGER INDEX: 2.518 -> 2.523 (+0.2%)
. FLOATING-POINT INDEX: 0.385 -> 0.394 (+2.34%)Those tests show that it became even faster :))
But I'm quite sceptical about such results.
The thing is that in case of nbench it prints the warning if results are not 95% statistically accurate. So we can be sure that nbench result is 95% accurate.
And it's obvious that result shown above are in the scope of this accuracy.
I don't know the accuracy of CoreMark.
So, the main decision we can make that this patch series didn't introduce any slow-down comparable to inaccuracy of the measurement.
Is this enough?
Quoted 51 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't have an interface to pass pointer totcg_ctx.
Code style clean-upEvgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variablesEvgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Today I made more precise testing with usage of --enable-profiler.
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:
Before clean-up:
min: 731.9
max: 735.8
avg: 734.3
standard deviation: ~2 = 0.3%
Avarage cycles/op = 734 +- 2
After clean-up:
min: 747.2
max: 751.7
avg: 750.5
standard deviation: ~2 = 0.3%
Avarage cycles/op = 750 +- 2
Slow-down of TCG code generation = 2.2%
After clean-up with TCGContext *const tcg_cur_ctx:
min: 730.6
max: 733.2
avg: 728.7
standard deviation: ~2 = 0.3%
Avarage cycles/op = 729 +- 2
Slow-down of TCG code generation = 0%
I suggest to define tcg_cur_ctx as TCGContext *const. Then we will get rid of TCG code generation slow-down and also will have no usage of global variables.
Quoted 87 lines · Evgeny Voevodin
Here are the results of tests before and after this patch series was applied:
* EEMBC CoreMark (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results: 1148.105626 -> 1161.440186 (+1.16%)* nbench (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results. MEMORY INDEX: 1.864 -> 1.862 (-0.11%) . INTEGER INDEX: 2.518 -> 2.523 (+0.2%) . FLOATING-POINT INDEX: 0.385 -> 0.394 (+2.34%)Those tests show that it became even faster :))
But I'm quite sceptical about such results.
The thing is that in case of nbench it prints the warning if results are not 95% statistically accurate.
So we can be sure that nbench result is 95% accurate.
And it's obvious that result shown above are in the scope of this accuracy. I don't know the accuracy of CoreMark.So, the main decision we can make that this patch series didn't introduce any slow-down comparable to inaccuracy of the measurement.
Is this enough?
Quoted 53 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't
have an interface to pass pointer totcg_ctx.
Code style clean-upEvgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variablesEvgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]
Quoted 33 lines · Evgeny Voevodin
Today I made more precise testing with usage of --enable-profiler.
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:
Before clean-up:
min: 731.9
max: 735.8
avg: 734.3
standard deviation: ~2 = 0.3%
Avarage cycles/op = 734 +- 2After clean-up:
min: 747.2
max: 751.7
avg: 750.5
standard deviation: ~2 = 0.3%
Avarage cycles/op = 750 +- 2
Slow-down of TCG code generation = 2.2%After clean-up with TCGContext *const
tcg_cur_ctx:
min: 730.6
max: 733.2
avg: 728.7
standard deviation: ~2 = 0.3%
Avarage cycles/op = 729 +- 2
Slow-down of TCG code generation = 0%
Quoted 3 lines
I suggest to define
tcg_cur_ctxas TCGContext *const. Then we will get rid of TCG code generation slow-down and also will have no usage of global variables.
How does this compare with the original version without pointers? I think that version may be safer to be assumed to be optimized by the compiler.
Quoted 102 lines · Evgeny Voevodin
Quoted 28 lines
Here are the results of tests before and after this patch series was applied:
* EEMBC CoreMark (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results: 1148.105626 -> 1161.440186 (+1.16%)* nbench (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results. MEMORY INDEX: 1.864 -> 1.862 (-0.11%) . INTEGER INDEX: 2.518 -> 2.523 (+0.2%) . FLOATING-POINT INDEX: 0.385 -> 0.394 (+2.34%)Those tests show that it became even faster :))
But I'm quite sceptical about such results.
The thing is that in case of nbench it prints the warning if results are not 95% statistically accurate.
So we can be sure that nbench result is 95% accurate.
And it's obvious that result shown above are in the scope of this accuracy.
I don't know the accuracy of CoreMark.Quoted 62 lines
So, the main decision we can make that this patch series didn't introduce any slow-down comparable to inaccuracy of the measurement.
Is this enough?
Quoted 54 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't
have an interface to pass pointer totcg_ctx.
Code style clean-upEvgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variablesEvgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)--
Kind regards,
Evgeny Voevodin,
Technical Leader,
Mobile Group,
Samsung Moscow Research Center,
e-mail: [email protected]
Quoted 34 lines · Blue Swirl
Quoted 33 lines · Evgeny Voevodin
Today I made more precise testing with usage of --enable-profiler.
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:
Before clean-up:
min: 731.9
max: 735.8
avg: 734.3
standard deviation: ~2 = 0.3%
Avarage cycles/op = 734 +- 2After clean-up:
min: 747.2
max: 751.7
avg: 750.5
standard deviation: ~2 = 0.3%
Avarage cycles/op = 750 +- 2
Slow-down of TCG code generation = 2.2%After clean-up with TCGContext *const
tcg_cur_ctx:
min: 730.6
max: 733.2
avg: 728.7
standard deviation: ~2 = 0.3%
Avarage cycles/op = 729 +- 2
Slow-down of TCG code generation = 0%
Quoted 6 lines
Quoted 3 lines
I suggest to define
tcg_cur_ctxas TCGContext *const. Then we will get rid of TCG code generation slow-down and also will have no usage of global variables.How does this compare with the original version without pointers? I think that version may be safer to be assumed to be optimized by the compiler.
I did more testing with different gcc versions and different patch series:
gcc verion v1 clean-up, no pointer v2 clean-up, const pointer
master
gcc-4.4 754.3 752.1
769.8
gcc-4.5 770.8 779.8
774.8
gcc-4.6 731.8 729.8
737Conclusion:
- First clean-up series without pointer operates faster than master in
all cases. It's probably because
data is cached more efficiently.
- Second clean-up series with constant pointer operates faster than
master in the case of gcc-4.4 and gcc-4.6.
In the case of gcc-4.5 it seems that const pointer is not optimised
as I assumed.
I think that it's worth to generate third series without pointer and with code clean-up included in second.
How do you think?
Quoted 97 lines
Quoted 97 lines · Evgeny Voevodin
Quoted 27 lines
Here are the results of tests before and after this patch series was applied:
* EEMBC CoreMark (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results: 1148.105626 -> 1161.440186 (+1.16%)* nbench (before -> after)
- Guest: Exynos4210 ARMv7, Linux (Custom buildroot image)
- Host: Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz, 4GB RAM, Linux
- Results
. MEMORY INDEX: 1.864 -> 1.862 (-0.11%)
. INTEGER INDEX: 2.518 -> 2.523 (+0.2%)
. FLOATING-POINT INDEX: 0.385 -> 0.394 (+2.34%)Those tests show that it became even faster :))
But I'm quite sceptical about such results.
The thing is that in case of nbench it prints the warning if results are not 95% statistically accurate.
So we can be sure that nbench result is 95% accurate.
And it's obvious that result shown above are in the scope of this accuracy.
I don't know the accuracy of CoreMark.Quoted 60 lines
So, the main decision we can make that this patch series didn't introduce any slow-down comparable to inaccuracy of the measurement.
Is this enough?
Quoted 53 lines · Evgeny Voevodin
This set of patches moves global variables to
tcg_ctx:gen_opc_ptrgen_opparam_ptrgen_opc_bufgen_opparam_bufBuild tested for all targets.
Execution tested on ARM.I didn't notice any slow-down of kernel boot after this set was applied.
Changelog:
v1->v2:
Introduced TCGContext*tcg_cur_ctxglobal to use in those places where we don't
have an interface to pass pointer totcg_ctx.
Code style clean-upEvgeny (2):
tcg/tcg.h: Duplicate global TCG variables in TCGContext
TCG: Remove unused global variablesEvgeny Voevodin (5):
translate-all.c: Introduce TCGContext*tcg_cur_ctx
TCG: Usegen_opc_ptrfrom context instead of global variable.
TCG: Usegen_opparam_ptrfrom context instead of global variable.
TCG: Usegen_opc_buffrom context instead of global variable.
TCG: Usegen_opparam_buffrom context instead of global variable.gen-icount.h | 2 +- target-alpha/translate.c | 10 +- target-arm/translate.c | 10 +- target-cris/translate.c | 13 +- target-i386/translate.c | 10 +- target-lm32/translate.c | 13 +- target-m68k/translate.c | 10 +- target-microblaze/translate.c | 13 +- target-mips/translate.c | 11 +- target-openrisc/translate.c | 13 +- target-ppc/translate.c | 11 +- target-s390x/translate.c | 11 +- target-sh4/translate.c | 10 +- target-sparc/translate.c | 10 +- target-unicore32/translate.c | 10 +- target-xtensa/translate.c | 8 +- tcg/optimize.c | 62 ++++---- tcg/tcg-op.h | 324 ++++++++++++++++++++--------------------- tcg/tcg.c | 85 ++++++----- tcg/tcg.h | 11 +- translate-all.c | 4 +- 21 files changed, 328 insertions(+), 323 deletions(-)--
Kind regards,
Evgeny Voevodin,
Technical Leader,
Mobile Group,
Samsung Moscow Research Center,
e-mail: [email protected]
Signature · 6 lines
Kind regards, Evgeny Voevodin, Technical Leader, Mobile Group, Samsung Moscow Research Center, e-mail: [email protected]