qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v1 2/3] tcg-runtime: light re-factor of lookup_t


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v1 2/3] tcg-runtime: light re-factor of lookup_tb_ptr
Date: Wed, 14 Jun 2017 08:44:50 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 06/14/2017 07:02 AM, Alex Bennée wrote:
Just a little precursor re-factoring before I was going to add a trace
point:

   - single return point, defaulting to tcg_ctx.code_gen_epilogue

Why? Any if you're going to do that, why not init ret = epilogue and avoid the null test at the end?

   - move cs_base, pc and flags inside the jump cache hit scope

Funny story. While looking at this again, I notice that there's no reason to avoid, and every reason not to avoid, calling tb_htable_lookup when tb_jmp_cache is empty. So I'm now doing

    tb = atomic_rcu_read(...);
    cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);

    if (!(tb && tb->pc == addr && ...)) {
        tb = tb_htable_lookup(...);
        ...

   - calculate the tb_jmp_cache hash once

I did look once and the compiler is doing the CSE.  But it does look cleaner.


r~



reply via email to

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