target/alpha cleanups
The new title holder for perf top is helper_lookup_tb_ptr. Those targets that have a complicated cpu_get_tb_cpu_state function are going to regret that.
This cleans up the Alpha version of that function such that it is just two loads and one mask. Which is one practically-free mask away from being as minimal as one can get.
Also, in anticipation of LLuis' generic translation loop, fix all of the temporary leaks. They all seem to have been on insns that end the TB, so in practice they weren't harmful, but...
r~
The following changes since commit 6887dc6700ccb7820d8a9d370f421ee361c748e8:
Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20170718' into staging (2017-07-18 21:13:48 +0100)
are available in the git repository at:
git://github.com/rth7680/qemu.git tags/pull-axp-20170718
for you to fetch changes up to 8aa5c65fd3d4612d8ab690bef0980d26f30f381d:
target/alpha: Log temp leaks (2017-07-18 18:42:05 -1000)
----------------------------------------------------------------
Queued target/alpha patches
----------------------------------------------------------------
Richard Henderson (8):
target/alpha: Remove amask from tb->flags target/alpha: Copy tb->flags into DisasContext target/alpha: Merge several flag bytes into ENV->FLAGS target/alpha: Fix temp leak in gen_bcond target/alpha: Fix temp leak in gen_mtpr target/alpha: Fix temp leak in gen_call_pal target/alpha: Fix temp leak in gen_fbcond target/alpha: Log temp leaks
target/alpha/cpu.h | 79 +++++++---------- hw/alpha/dp264.c | 1 - linux-user/main.c | 25 +++--- target/alpha/cpu.c | 7 +- target/alpha/helper.c | 12 +-- target/alpha/machine.c | 10 +-- target/alpha/translate.c | 221 +++++++++++++++++++++++++++++------------------ 7 files changed, 194 insertions(+), 161 deletions(-)
[Qemu-devel] [PULL 1/8] target/alpha: Remove amask from tb->flags
This value is constant for the cpu and does not need to be stored within the TB.
--- target/alpha/cpu.h | 9 ------- target/alpha/translate.c | 70 ++++++++++++++++++++++++++---------------------- 2 files changed, 38 insertions(+), 41 deletions(-)
target/alpha/cpu.h +0 -9
@@ -487,14 +487,6 @@ enum {TB_FLAGS_PAL_MODE =1 ,TB_FLAGS_FEN =2 , TB_FLAGS_USER_MODE = 8, - -TB_FLAGS_AMASK_SHIFT =4 , -TB_FLAGS_AMASK_BWX =AMASK_BWX <<TB_FLAGS_AMASK_SHIFT , -TB_FLAGS_AMASK_FIX =AMASK_FIX <<TB_FLAGS_AMASK_SHIFT , -TB_FLAGS_AMASK_CIX =AMASK_CIX <<TB_FLAGS_AMASK_SHIFT , -TB_FLAGS_AMASK_MVI =AMASK_MVI <<TB_FLAGS_AMASK_SHIFT , -TB_FLAGS_AMASK_TRAP =AMASK_TRAP <<TB_FLAGS_AMASK_SHIFT , - TB_FLAGS_AMASK_PREFETCH = AMASK_PREFETCH << TB_FLAGS_AMASK_SHIFT, }; static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc,
@@ -513,7 +505,6 @@ static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc,if (env->fen) { flags |=TB_FLAGS_FEN ; } - flags |= env->amask <<TB_FLAGS_AMASK_SHIFT ; *pflags = flags; }
target/alpha/translate.c +38 -32
236 lines not on this page · raw message
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 2/8] target/alpha: Copy tb->flags into DisasContext
In reply to Richard Henderson--- target/alpha/translate.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
target/alpha/translate.c +7 -5
@@ -49,6 +49,7 @@ struct DisasContext {#ifndef CONFIG_USER_ONLY uint64_t palbr;#endif +uint32_t tbflags;int mem_idx;/* implver and amask values for this CPU. */
@@ -452,7 +453,7 @@ static ExitStatus gen_store_conditional(DisasContext *ctx, int ra, int rb,static bool in_superpage (DisasContext *ctx,int64_t addr) {#ifndef CONFIG_USER_ONLY -return ((ctx->tb->flags &TB_FLAGS_USER_MODE ) ==0 +return ((ctx->tbflags &TB_FLAGS_USER_MODE ) ==0 && addr >>TARGET_VIRT_ADDR_SPACE_BITS ==-1 && ((addr >>41 ) &3 ) ==2 );#else
@@ -1167,7 +1168,7 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)#ifndef CONFIG_USER_ONLY /* Privileged PAL code */ -if (palcode <0x40 && (ctx->tb->flags &TB_FLAGS_USER_MODE ) ==0 ) { +if (palcode <0x40 && (ctx->tbflags &TB_FLAGS_USER_MODE ) ==0 ) {TCGv tmp;switch (palcode) {case 0x01 :
@@ -1258,7 +1259,7 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)uint64_t exc_addr = ctx->pc;uint64_t entry = ctx->palbr; -if (ctx->tb->flags &TB_FLAGS_PAL_MODE ) { +if (ctx->tbflags &TB_FLAGS_PAL_MODE ) { exc_addr |=1 ; }else {tcg_gen_movi_i64 (tmp,1 );
@@ -1452,7 +1453,7 @@ static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno)#define REQUIRE_TB_FLAG (FLAG ) \ do { \ - if ((ctx->tb->flags & (FLAG)) == 0) { \ + if ((ctx->tbflags & (FLAG)) == 0) { \ goto invalid_opc; \ } \ } while (0)
@@ -2932,6 +2933,7 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) ctx.tb = tb; ctx.pc = pc_start; + ctx.tbflags = tb->flags; ctx.mem_idx =cpu_mmu_index (env, false); ctx.implver = env->implver; ctx.amask = env->amask;
@@ -2941,7 +2943,7 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) ctx.ir = cpu_std_ir;#else ctx.palbr = env->palbr; - ctx.ir = (tb->flags &TB_FLAGS_PAL_MODE ? cpu_pal_ir : cpu_std_ir); + ctx.ir = (ctx.tbflags &TB_FLAGS_PAL_MODE ? cpu_pal_ir : cpu_std_ir);#endif /* ??? Every TB begins with unset rounding mode, to be initialized on
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 4/8] target/alpha: Fix temp leak in gen_bcond
In reply to Richard Henderson--- target/alpha/translate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
target/alpha/translate.c +8 -8
@@ -565,16 +565,16 @@ static ExitStatus gen_bcond_internal(DisasContext *ctx, TCGCond cond,static ExitStatus gen_bcond (DisasContext *ctx,TCGCond cond,int ra,int32_t disp,int mask) { -TCGv cmp_tmp; -if (mask) { - cmp_tmp =tcg_temp_new (); -tcg_gen_andi_i64 (cmp_tmp,load_gpr (ctx, ra),1 ); - }else { - cmp_tmp =load_gpr (ctx, ra); - } +TCGv tmp =tcg_temp_new (); +ExitStatus ret; -return gen_bcond_internal (ctx, cond, cmp_tmp, disp); +tcg_gen_andi_i64 (tmp,load_gpr (ctx, ra),1 ); + ret =gen_bcond_internal (ctx, cond, tmp, disp); +tcg_temp_free (tmp); +return ret; + } +return gen_bcond_internal (ctx, cond,load_gpr (ctx, ra), disp); }/* Fold -0.0 for comparison with COND. */
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 3/8] target/alpha: Merge several flag bytes into ENV->FLAGS
In reply to Richard HendersonThe flags are arranged such that we can manipulate them either a whole, or as individual bytes. The computation within cpu_get_tb_cpu_state is now reduced to a single load and mask.
--- target/alpha/cpu.h | 70 +++++++++++++++++-------------------- hw/alpha/dp264.c | 1 - linux-user/main.c | 25 +++++++------ target/alpha/cpu.c | 7 ++-- target/alpha/helper.c | 12 +++---- target/alpha/machine.c | 10 ++---- target/alpha/translate.c | 91 +++++++++++++++++++++++++++++++----------------- 7 files changed, 117 insertions(+), 99 deletions(-)
target/alpha/cpu.h +31 -39
@@ -242,13 +242,11 @@ struct CPUAlphaState {uint8_t fpcr_dyn_round;uint8_t fpcr_flush_to_zero; -/* The Internal Processor Registers. Some of these we assume always -exist for use in user-mode. */ -uint8_t ps; -uint8_t intr_flag; -uint8_t pal_mode; -uint8_t fen; +/* Mask of PALmode, Processor State et al. Most of this gets copied +into the TranslatorBlock flags and controls code generation. */ +uint32_t flags; +/* The high 32-bits of the processor cycle counter. */ uint32_t pcc_ofs;/* These pass data from the exception logic in the translator and
@@ -398,24 +396,37 @@ enum { };/* Processor status constants. */ -enum { -/* Low 3 bits are interrupt mask level. */ -PS_INT_MASK =7 , +/* Low 3 bits are interrupt mask level. */ +#define PS_INT_MASK 7u -/* Bits 4 and 5 are the mmu mode. The VMS PALcode uses all 4 modes; -The Unix PALcode only uses bit 4. */ -PS_USER_MODE =8 -}; +/* Bits 4 and 5 are the mmu mode. The VMS PALcode uses all 4 modes; +The Unix PALcode only uses bit 4. */ +#define PS_USER_MODE 8u + +/* CPUAlphaState->flags constants. These are layed out so that we +can set or reset the pieces individually by assigning to the byte, +or manipulated as a whole. */ + +#define ENV_FLAG_PAL_SHIFT 0 +#define ENV_FLAG_PS_SHIFT 8 +#define ENV_FLAG_RX_SHIFT 16 +#define ENV_FLAG_FEN_SHIFT 24 + +#define ENV_FLAG_PAL_MODE (1u << ENV_FLAG_PAL_SHIFT) +#define ENV_FLAG_PS_USER (PS_USER_MODE << ENV_FLAG_PS_SHIFT) +#define ENV_FLAG_RX_FLAG (1u << ENV_FLAG_RX_SHIFT) +#define ENV_FLAG_FEN (1u << ENV_FLAG_FEN_SHIFT) + +#define ENV_FLAG_TB_MASK \ + (ENV_FLAG_PAL_MODE | ENV_FLAG_PS_USER | ENV_FLAG_FEN)static inline int cpu_mmu_index (CPUAlphaState *env,bool ifetch) { -if (env->pal_mode) { -return MMU_KERNEL_IDX ; - }else if (env->ps &PS_USER_MODE ) { -return MMU_USER_IDX ; - }else { -return MMU_KERNEL_IDX ; +int ret = env->flags &ENV_FLAG_PS_USER ?MMU_USER_IDX :MMU_KERNEL_IDX ; +if (env->flags &ENV_FLAG_PAL_MODE ) { + ret =MMU_KERNEL_IDX ; } +return ret; }enum {
@@ -482,31 +493,12 @@ QEMU_NORETURN void alpha_cpu_unassigned_access(CPUState *cpu, hwaddr addr, int unused, unsigned size);#endif -/* Bits in TB->FLAGS that control how translation is processed. */ -enum { -TB_FLAGS_PAL_MODE =1 , -TB_FLAGS_FEN =2 , -TB_FLAGS_USER_MODE =8 , -}; -static inline void cpu_get_tb_cpu_state (CPUAlphaState *env,target_ulong *pc,target_ulong *cs_base,uint32_t *pflags) { -int flags =0 ; - *pc = env->pc; *cs_base =0 ; - -if (env->pal_mode) { - flags =TB_FLAGS_PAL_MODE ; - }else { - flags = env->ps &PS_USER_MODE ; - } -if (env->fen) { - flags |=TB_FLAGS_FEN ; - } - - *pflags = flags; + *pflags = env->flags &ENV_FLAG_TB_MASK ; }#endif /* ALPHA_CPU_H */
hw/alpha/dp264.c +0 -1
@@ -123,7 +123,6 @@ static void clipper_init(MachineState *machine)/* Start all cpus at the PALcode RESET entry point. */ for (i =0 ; i < smp_cpus; ++i) { - cpus[i]->env.pal_mode =1 ; cpus[i]->env.pc = palcode_entry; cpus[i]->env.palbr = palcode_entry; }
linux-user/main.c +14 -11
@@ -3037,16 +3037,13 @@ void cpu_loop(CPUAlphaState *env)abi_long sysret;while (1 ) { +bool arch_interrupt = true; +cpu_exec_start (cs); trapnr =cpu_exec (cs);cpu_exec_end (cs);process_queued_cpu_work (cs); -/* All of the traps imply a transition through PALcode, which -implies an REI instruction has been executed. Which means -that the intr_flag should be cleared. */ - env->intr_flag =0 ; -switch (trapnr) {case EXCP_RESET :fprintf (stderr,"Reset requested. Exit\n" );
@@ -3063,7 +3060,6 @@ void cpu_loop(CPUAlphaState *env)exit (EXIT_FAILURE );break ;case EXCP_MMFAULT : - env->lock_addr =-1 ; info.si_signo =TARGET_SIGSEGV ; info.si_errno =0 ; info.si_code = (page_get_flags(env->trap_arg0) & PAGE_VALID
@@ -3072,7 +3068,6 @@ void cpu_loop(CPUAlphaState *env)queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info);break ;case EXCP_UNALIGN : - env->lock_addr =-1 ; info.si_signo =TARGET_SIGBUS ; info.si_errno =0 ; info.si_code =TARGET_BUS_ADRALN ;
@@ -3081,7 +3076,6 @@ void cpu_loop(CPUAlphaState *env)break ;case EXCP_OPCDEC : do_sigill: - env->lock_addr =-1 ; info.si_signo =TARGET_SIGILL ; info.si_errno =0 ; info.si_code =TARGET_ILL_ILLOPC ;
@@ -3089,7 +3083,6 @@ void cpu_loop(CPUAlphaState *env)queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info);break ;case EXCP_ARITH : - env->lock_addr =-1 ; info.si_signo =TARGET_SIGFPE ; info.si_errno =0 ; info.si_code =TARGET_FPE_FLTINV ;
@@ -3100,7 +3093,6 @@ void cpu_loop(CPUAlphaState *env)/* No-op. Linux simply re-enables the FPU. */ break ;case EXCP_CALL_PAL : - env->lock_addr =-1 ;switch (env->error_code) {case 0x80 :/* BPT */
@@ -3197,10 +3189,11 @@ void cpu_loop(CPUAlphaState *env)case EXCP_DEBUG : info.si_signo =gdb_handlesig (cs,TARGET_SIGTRAP );if (info.si_signo) { - env->lock_addr =-1 ; info.si_errno =0 ; info.si_code =TARGET_TRAP_BRKPT ;queue_signal (env, info.si_signo,QEMU_SI_FAULT , &info); + }else { + arch_interrupt = false; }break ;case EXCP_INTERRUPT :
@@ -3208,6 +3201,7 @@ void cpu_loop(CPUAlphaState *env)break ;case EXCP_ATOMIC :cpu_exec_step_atomic (cs); + arch_interrupt = false;break ;default :printf ("Unhandled trap: 0x%x\n" , trapnr);
@@ -3215,6 +3209,15 @@ void cpu_loop(CPUAlphaState *env) exit(EXIT_FAILURE); }process_pending_signals (env); + +/* Most of the traps imply a transition through PALcode, which +implies an REI instruction has been executed. Which means +that RX and LOCK_ADDR should be cleared. But there are a +few exceptions for traps internal to QEMU. */ +if (arch_interrupt) { + env->flags &= ~ENV_FLAG_RX_FLAG ; + env->lock_addr =-1 ; + } } }#endif /* TARGET_ALPHA */
target/alpha/cpu.c +4 -3
@@ -276,14 +276,15 @@ static void alpha_cpu_initfn(Object *obj)alpha_translate_init (); + env->lock_addr =-1 ;#if defined(CONFIG_USER_ONLY ) - env->ps =PS_USER_MODE ; + env->flags =ENV_FLAG_PS_USER |ENV_FLAG_FEN ;cpu_alpha_store_fpcr (env, (FPCR_INVD |FPCR_DZED |FPCR_OVFD |FPCR_UNFD |FPCR_INED |FPCR_DNOD |FPCR_DYN_NORMAL )); +#else + env->flags =ENV_FLAG_PAL_MODE |ENV_FLAG_FEN ;#endif - env->lock_addr =-1 ; - env->fen =1 ; }static void alpha_cpu_class_init (ObjectClass *oc,void *data)
target/alpha/helper.c +6 -6
@@ -81,7 +81,7 @@ void helper_store_fpcr(CPUAlphaState *env, uint64_t val)static uint64_t *cpu_alpha_addr_gr (CPUAlphaState *env,unsigned reg) {#ifndef CONFIG_USER_ONLY -if (env->pal_mode) { +if (env->flags &ENV_FLAG_PAL_MODE ) {if (reg >=8 && reg <=14 ) {return &env->shadow[reg -8 ]; }else if (reg ==25 ) {
@@ -364,13 +364,13 @@ void alpha_cpu_do_interrupt(CPUState *cs)/* Remember where the exception happened. Emulate real hardware in that the low bit of the PC indicates PALmode. */ - env->exc_addr = env->pc | env->pal_mode; + env->exc_addr = env->pc | (env->flags &ENV_FLAG_PAL_MODE );/* Continue execution at the PALcode entry point. */ env->pc = env->palbr + i;/* Switch to PALmode. */ - env->pal_mode =1 ; + env->flags |=ENV_FLAG_PAL_MODE ;#endif /* !USER_ONLY */ }
@@ -381,14 +381,14 @@ bool alpha_cpu_exec_interrupt(CPUState *cs, int interrupt_request)int idx =-1 ;/* We never take interrupts while in PALmode. */ -if (env->pal_mode) { +if (env->flags &ENV_FLAG_PAL_MODE ) {return false; }/* Fall through the switch, collecting the highest priority interrupt that isn't masked by the processor status IPL. */ /* ??? This hard-codes the OSF/1 interrupt levels. */ -switch (env->ps &PS_INT_MASK ) { +switch ((env->flags >>ENV_FLAG_PS_SHIFT ) &PS_INT_MASK ) { case 0 ... 3:if (interrupt_request &CPU_INTERRUPT_HARD ) { idx =EXCP_DEV_INTERRUPT ;
@@ -432,7 +432,7 @@ void alpha_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,int i;cpu_fprintf (f," PC " TARGET_FMT_lx" PS %02x\n" , - env->pc, env->ps); + env->pc,extract32 (env->flags,ENV_FLAG_PS_SHIFT ,8 ));for (i =0 ; i <31 ; i++) {cpu_fprintf (f,"IR%02d %s " TARGET_FMT_lx" " , i, linux_reg_names[i],cpu_alpha_load_gr (env, i));
target/alpha/machine.c +3 -7
@@ -48,11 +48,7 @@ static VMStateField vmstate_env_fields[] = {VMSTATE_UINTTL (lock_addr, CPUAlphaState),VMSTATE_UINTTL (lock_value, CPUAlphaState), -VMSTATE_UINT8 (ps, CPUAlphaState), -VMSTATE_UINT8 (intr_flag, CPUAlphaState), -VMSTATE_UINT8 (pal_mode, CPUAlphaState), -VMSTATE_UINT8 (fen, CPUAlphaState), - +VMSTATE_UINT32 (flags, CPUAlphaState),VMSTATE_UINT32 (pcc_ofs, CPUAlphaState), VMSTATE_UINTTL(trap_arg0, CPUAlphaState),
@@ -74,8 +70,8 @@ static VMStateField vmstate_env_fields[] = {static const VMStateDescription vmstate_env = { .name ="env" , - .version_id =2 , - .minimum_version_id =2 , + .version_id =3 , + .minimum_version_id =3 , .fields = vmstate_env_fields, };
target/alpha/translate.c +59 -32
224 lines not on this page · raw message
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 5/8] target/alpha: Fix temp leak in gen_mtpr
In reply to Richard Henderson--- target/alpha/translate.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
target/alpha/translate.c +6 -4
@@ -1392,7 +1392,6 @@ static ExitStatus gen_mfpr(DisasContext *ctx, TCGv va, int regno)static ExitStatus gen_mtpr (DisasContext *ctx,TCGv vb,int regno) { -TCGv tmp;int data;switch (regno) {
@@ -1408,9 +1407,12 @@ static ExitStatus gen_mtpr(DisasContext *ctx, TCGv vb, int regno)case 253 :/* WAIT */ - tmp =tcg_const_i64 (1 ); -tcg_gen_st32_i64 (tmp, cpu_env, -offsetof(AlphaCPU , env) + - offsetof(CPUState , halted)); + { +TCGv_i32 tmp =tcg_const_i32 (1 ); +tcg_gen_st_i32 (tmp, cpu_env, -offsetof(AlphaCPU , env) + + offsetof(CPUState , halted)); +tcg_temp_free_i32 (tmp); + }return gen_excp (ctx,EXCP_HALTED ,0 );case 252 :
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 6/8] target/alpha: Fix temp leak in gen_call_pal
In reply to Richard Henderson--- target/alpha/translate.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
target/alpha/translate.c +12 -8
@@ -1189,7 +1189,6 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)#ifndef CONFIG_USER_ONLY /* Privileged PAL code */ if (palcode <0x40 && (ctx->tbflags &ENV_FLAG_PS_USER ) ==0 ) { -TCGv tmp;switch (palcode) {case 0x01 :/* CFLUSH */
@@ -1222,10 +1221,12 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)ld_flag_byte (ctx->ir[IR_V0 ],ENV_FLAG_PS_SHIFT );/* But make sure and store only the 3 IPL bits from the user. */ - tmp =tcg_temp_new (); -tcg_gen_andi_i64 (tmp, ctx->ir[IR_A0 ],PS_INT_MASK ); -st_flag_byte (tmp,ENV_FLAG_PS_SHIFT ); -tcg_temp_free (tmp); + { +TCGv tmp =tcg_temp_new (); +tcg_gen_andi_i64 (tmp, ctx->ir[IR_A0 ],PS_INT_MASK ); +st_flag_byte (tmp,ENV_FLAG_PS_SHIFT ); +tcg_temp_free (tmp); + }/* Allow interrupts to be recognized right away. */ tcg_gen_movi_i64 (cpu_pc, ctx->pc);
@@ -1254,9 +1255,12 @@ static ExitStatus gen_call_pal(DisasContext *ctx, int palcode)case 0x3E :/* WTINT */ - tmp =tcg_const_i64 (1 ); -tcg_gen_st32_i64 (tmp, cpu_env, -offsetof(AlphaCPU , env) + - offsetof(CPUState , halted)); + { +TCGv_i32 tmp =tcg_const_i32 (1 ); +tcg_gen_st_i32 (tmp, cpu_env, -offsetof(AlphaCPU , env) + + offsetof(CPUState , halted)); +tcg_temp_free_i32 (tmp); + }tcg_gen_movi_i64 (ctx->ir[IR_V0 ],0 );return gen_excp (ctx,EXCP_HALTED ,0 );
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 7/8] target/alpha: Fix temp leak in gen_fbcond
In reply to Richard Henderson--- target/alpha/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
target/alpha/translate.c +5 -1
@@ -613,8 +613,12 @@ static ExitStatus gen_fbcond(DisasContext *ctx, TCGCond cond, int ra, int32_t disp) {TCGv cmp_tmp =tcg_temp_new (); +ExitStatus ret; +gen_fold_mzero (cond, cmp_tmp,load_fpr (ctx, ra)); -return gen_bcond_internal (ctx, cond, cmp_tmp, disp); + ret =gen_bcond_internal (ctx, cond, cmp_tmp, disp); +tcg_temp_free (cmp_tmp); +return ret; }static void gen_fcmov (DisasContext *ctx,TCGCond cond,int ra,int rb,int rc)
Signature · 1 line
2.9.4
[Qemu-devel] [PULL 8/8] target/alpha: Log temp leaks
In reply to Richard Henderson--- target/alpha/translate.c | 6 ++++++ 1 file changed, 6 insertions(+)
target/alpha/translate.c +6 -0
@@ -3013,6 +3013,8 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) }gen_tb_start (tb); +tcg_clear_temp_count (); + do { tcg_gen_insn_start(ctx.pc); num_insns++;
@@ -3035,6 +3037,10 @@ void gen_intermediate_code(CPUAlphaState *env, struct TranslationBlock *tb) ret =translate_one (ctxp, insn);free_context_temps (ctxp); +if (tcg_check_temp_count ()) { +qemu_log ("TCG temporary leak before " TARGET_FMT_lx"\n" , ctx.pc); + } +/* If we reach a page boundary, are single stepping, or exhaust instruction count, stop generation. */ if (ret == NO_EXIT
Signature · 1 line
2.9.4
Quoted 3 lines · Richard Henderson
The new title holder for perf top is
helper_lookup_tb_ptr. Those targets that have a complicatedcpu_get_tb_cpu_statefunction are going to regret that.
Yeah, Paolo's pointed out (and had some patches for) ARM's rather complicated cpu_get_tb_cpu_state(). My issue with his suggested fixes was that they were pretty fragile in terms of not having any guarantee that the change always produced the right tb cpu state flags answer...
(I'm processing the pullreq, this just seemed like an interesting digression.)
thanks
-- PMM
Peter Maydell
AppliedQuoted 22 lines · Richard Henderson
The new title holder for perf top is
helper_lookup_tb_ptr. Those targets that have a complicatedcpu_get_tb_cpu_statefunction are going to regret that.This cleans up the Alpha version of that function such that it is just two loads and one mask. Which is one practically-free mask away from being as minimal as one can get.
Also, in anticipation of LLuis' generic translation loop, fix all of the temporary leaks. They all seem to have been on insns that end the TB, so in practice they weren't harmful, but...
r~
The following changes since commit
6887dc6700ccb7820d8a9d370f421ee361c748e8:Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20170718' into staging (2017-07-18 21:13:48 +0100)
are available in the git repository at:
Quoted 9 lines
git://github.com/rth7680/qemu.gittags/pull-axp-20170718for you to fetch changes up to
8aa5c65fd3d4612d8ab690bef0980d26f30f381d:target/alpha: Log temp leaks (2017-07-18 18:42:05 -1000)
----------------------------------------------------------------
Queued target/alpha patches
Applied, thanks.
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 3 lines · Richard Henderson
The new title holder for perf top is
helper_lookup_tb_ptr. Those targets that have a complicatedcpu_get_tb_cpu_statefunction are going to regret that.Yeah, Paolo's pointed out (and had some patches for) ARM's rather complicated
cpu_get_tb_cpu_state(). My issue with his suggested fixes was that they were pretty fragile in terms of not having any guarantee that the change always produced the right tb cpu state flags answer...
Oh? I must have missed seeing this one.
A quick patchwork search doesn't pull it up;
do either of you have a link?
r~
Quoted 17 lines · Richard Henderson
Quoted 8 lines · Peter Maydell
Quoted 4 lines · Richard Henderson
The new title holder for perf top is
helper_lookup_tb_ptr. Those targets that have a complicatedcpu_get_tb_cpu_statefunction are going to regret that.Quoted 6 lines
Yeah, Paolo's pointed out (and had some patches for) ARM's rather complicated
cpu_get_tb_cpu_state(). My issue with his suggested fixes was that they were pretty fragile in terms of not having any guarantee that the change always produced the right tb cpu state flags answer...
Quoted 3 lines
Oh? I must have missed seeing this one.
A quick patchwork search doesn't pull it up;
do either of you have a link?
It was back in September:
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03133.html
thanks
-- PMM
I am planning to refresh the series for 2.11.
Paolo
Il 20/lug/2017 11:07, "Peter Maydell" <[email protected]> ha scritto:
Quoted 29 lines · Richard Henderson
Quoted 17 lines · Peter Maydell
Quoted 8 lines · Richard Henderson
Quoted 4 lines
The new title holder for perf top is
helper_lookup_tb_ptr. Those targets that have a complicatedcpu_get_tb_cpu_statefunction are going to regret that.Quoted 6 lines
Yeah, Paolo's pointed out (and had some patches for) ARM's rather complicated
cpu_get_tb_cpu_state(). My issue with his suggested fixes was that they were pretty fragile in terms of not having any guarantee that the change always produced the right tb cpu state flags answer...Quoted 3 lines
Oh? I must have missed seeing this one.
A quick patchwork search doesn't pull it up;
do either of you have a link?It was back in September:
https://lists.gnu.org/archive/html/qemu-devel/2016-09/msg03133.htmlthanks
-- PMM