qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 05/10] cpu-exec: elide more icount code if CONFI


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 05/10] cpu-exec: elide more icount code if CONFIG_USER_ONLY
Date: Fri, 28 Aug 2015 15:56:05 +0100

On 12 August 2015 at 17:40, Paolo Bonzini <address@hidden> wrote:
> Signed-off-by: Paolo Bonzini <address@hidden>
> ---
>  cpu-exec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index 599e64d..bde5fd1 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -228,6 +228,7 @@ static inline tcg_target_ulong cpu_tb_exec(CPUState *cpu, 
> uint8_t *tb_ptr)
>      return next_tb;
>  }
>
> +#if defined(CONFIG_SOFTMMU)
>  /* Execute the code without caching the generated code. An interpreter
>     could be used if available. */
>  static void cpu_exec_nocache(CPUState *cpu, int max_cycles,
> @@ -251,6 +252,7 @@ static void cpu_exec_nocache(CPUState *cpu, int 
> max_cycles,
>      tb_phys_invalidate(tb, -1);
>      tb_free(tb);
>  }
> +#endif
>
>  static TranslationBlock *tb_find_slow(CPUState *cpu,
>                                        target_ulong pc,
> @@ -523,6 +525,9 @@ int cpu_exec(CPUState *cpu)
>                      case TB_EXIT_ICOUNT_EXPIRED:
>                      {
>                          /* Instruction counter expired.  */
> +#ifdef CONFIG_USER_ONLY
> +                        abort();
> +#else
>                          int insns_left = cpu->icount_decr.u32;
>                          if (cpu->icount_extra && insns_left >= 0) {
>                              /* Refill decrementer and continue execution.  */
> @@ -542,6 +547,7 @@ int cpu_exec(CPUState *cpu)
>                              cpu_loop_exit(cpu);
>                          }
>                          break;
> +#endif
>                      }
>                      default:
>                          break;

What's the rationale for this? Mostly we prefer not to
add ifdefs in code if we can get away with compiling it for
both cases, even if the resulting code isn't used.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]