Re: [Qemu-devel] [RFC PATCH v3 1/1] SPARC64: add icount support

2018-06-15 Thread Mark Cave-Ayland

On 14/06/18 23:40, Richard Henderson wrote:


On 06/14/2018 12:28 PM, Mark Cave-Ayland wrote:

@@ -5834,6 +5928,11 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, 
CPUState *cs)
  save_npc(dc);
  tcg_gen_exit_tb(NULL, 0);
  }
+} else if (dc->base.is_jmp == DISAS_EXIT) {
+/* Exit TB */
+save_state(dc);
+gen_op_next_insn();
+tcg_gen_exit_tb(NULL, 0);
  }


This doesn't look reachable, since the IF that goes with this ELSE is

 if (dc->base.is_jmp != DISAS_NORETURN) {

I suggest

 switch (dc->base.is_jmp) {
 case DISAS_NORETURN:
break;

 case DISAS_TOO_MANY:
/* existing block */
break;

 case DISAS_EXIT:
/* new code from above */

 default:
 g_assert_not_reached();
 }


Ah sorry my bad - it was getting quite late here.

Okay that works, although I noticed that I had to drop 
gen_op_next_insn() from the above code that was originally inline for it 
to work correctly in sparc_tr_tb_stop(). V4 is on its way shortly.



ATB,

Mark.



Re: [Qemu-devel] [RFC PATCH v3 1/1] SPARC64: add icount support

2018-06-14 Thread Richard Henderson
On 06/14/2018 12:28 PM, Mark Cave-Ayland wrote:
> @@ -5834,6 +5928,11 @@ static void sparc_tr_tb_stop(DisasContextBase *dcbase, 
> CPUState *cs)
>  save_npc(dc);
>  tcg_gen_exit_tb(NULL, 0);
>  }
> +} else if (dc->base.is_jmp == DISAS_EXIT) {
> +/* Exit TB */
> +save_state(dc);
> +gen_op_next_insn();
> +tcg_gen_exit_tb(NULL, 0);
>  }

This doesn't look reachable, since the IF that goes with this ELSE is

if (dc->base.is_jmp != DISAS_NORETURN) {

I suggest

switch (dc->base.is_jmp) {
case DISAS_NORETURN:
   break;

case DISAS_TOO_MANY:
   /* existing block */
   break;

case DISAS_EXIT:
   /* new code from above */

default:
g_assert_not_reached();
}


r~