On 09/10/2017 09:35 AM, Lluís Vilanova wrote:
> Signed-off-by: Lluís Vilanova <vilan...@ac.upc.edu>
> ---
>  accel/tcg/translator.c |   23 ++++++++++++++++++-----
>  trace-events           |    8 ++++++++
>  2 files changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
> index d66d601c89..c010aeee45 100644
> --- a/accel/tcg/translator.c
> +++ b/accel/tcg/translator.c
> @@ -35,7 +35,8 @@ void translator_loop_temp_check(DisasContextBase *db)
>  void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
>                       CPUState *cpu, TranslationBlock *tb)
>  {
> -    target_ulong pc_bbl;
> +    target_ulong pc_bbl, pc_insn = 0;
> +    bool translated_insn = false;
>      int max_insns;
>  
>      /* Initialize DisasContext */
> @@ -75,10 +76,15 @@ void translator_loop(const TranslatorOps *ops, 
> DisasContextBase *db,
>      tcg_debug_assert(db->is_jmp == DISAS_NEXT);  /* no early exit */
>  
>      while (true) {
> -        target_ulong pc_insn = db->pc_next;
>          TCGv_i32 insn_size_tcg = 0;
>          int insn_size_opcode_idx;
>  
> +        /* Tracing after (previous instruction) */
> +        if (db->num_insns > 0) {
> +            trace_guest_inst_after_tcg(cpu, tcg_ctx.tcg_env, pc_insn);
> +        }

How does this differ from "guest_inst"?  Why would you need two trace points?

Why are you placing this at the beginning of the while loop rather than the end?

> @@ -164,6 +172,9 @@ void translator_loop(const TranslatorOps *ops, 
> DisasContextBase *db,
>  
>          gen_set_inline_region_begin(tcg_ctx.disas.inline_label);
>  
> +        if (TRACE_GUEST_INST_AFTER_ENABLED && translated_insn) {
> +            trace_guest_inst_after_tcg(cpu, tcg_ctx.tcg_env, pc_insn);
> +        }
>          if (TRACE_GUEST_BBL_AFTER_ENABLED) {
>              trace_guest_bbl_after_tcg(cpu, tcg_ctx.tcg_env, pc_bbl);
>          }

I think I'm finally beginning to understand what you're after with your
inlining.  But I still think this should be doable in the appropriate opcode
generating functions.


r~

Reply via email to