qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 38/48] translator: implement 2-pass translation


From: Alex Bennée
Subject: Re: [Qemu-devel] [RFC 38/48] translator: implement 2-pass translation
Date: Mon, 26 Nov 2018 15:16:00 +0000
User-agent: mu4e 1.1.0; emacs 26.1.90

Emilio G. Cota <address@hidden> writes:

> The second pass only occurs when a plugin has subscribed to
> TB translation events.
>
> Signed-off-by: Emilio G. Cota <address@hidden>
> ---
>  tcg/tcg.h              |  8 ++++
>  accel/tcg/translator.c | 91 +++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 97 insertions(+), 2 deletions(-)
>
> diff --git a/tcg/tcg.h b/tcg/tcg.h
> index d5afe25c97..479b57d65f 100644
> --- a/tcg/tcg.h
> +++ b/tcg/tcg.h
> @@ -720,6 +720,14 @@ struct TCGContext {
>
>      TCGLabel *exitreq_label;
>
<snip>
>      }
>
> +    if (tb_trans_cb && first_pass) {
> +        qemu_plugin_tb_trans_cb(cpu, plugin_tb);
> +        first_pass = false;
> +        goto translate;
> +    }
> +

So the only reason we are doing this two pass tango is to ensure the
plugin can insert TCG ops before the actual translation has occurred?

I think we can do better, especially as the internal structures of
TCGops are implemented as a list so ops and be inserted before and after
other ops. This is currently only done by the optimiser at the moment,
see:

  TCGOp *tcg_op_insert_before(TCGContext *s, TCGOp *op, TCGOpcode opc, int 
narg);
  TCGOp *tcg_op_insert_after(TCGContext *s, TCGOp *op, TCGOpcode opc, int narg);

and all the base tcg ops end up going to tcg_emit_op which just appends
to the tail. But if we can come up with a neater way to track the op
used before the current translated expression we could do away with two
phases translation completely.

>      /* Emit code to exit the TB, as indicated by db->is_jmp.  */
>      ops->tb_stop(db, cpu);
>      gen_tb_end(db->tb, db->num_insns - bp_insn);


--
Alex Bennée



reply via email to

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