Richard Henderson <r...@twiddle.net> writes:

> 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?

That would be better. I think the NULL is left over from my originall
debugging when I had added a trace point and wanted to see when the
lookup had failed.

>
>>    - 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(...);
>         ...

OK I can fix on the next iteration.

>>    - calculate the tb_jmp_cache hash once
>
> I did look once and the compiler is doing the CSE.  But it does look cleaner.
>
>
> r~


--
Alex Bennée

Reply via email to