qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 11/22] translate-all: use a binary search tree t


From: Emilio G. Cota
Subject: Re: [Qemu-devel] [PATCH 11/22] translate-all: use a binary search tree to track TBs in TBContext
Date: Sun, 9 Jul 2017 17:01:28 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

On Sun, Jul 09, 2017 at 10:33:41 -1000, Richard Henderson wrote:
> On 07/08/2017 09:50 PM, Emilio G. Cota wrote:
> > #if defined(DEBUG_TB_FLUSH)
> >+    nb_tbs = g_tree_nnodes(tcg_ctx.tb_ctx.tb_tree);
> >     printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n",
> >            (unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer),
> >-           tcg_ctx.tb_ctx.nb_tbs, tcg_ctx.tb_ctx.nb_tbs > 0 ?
> >+           nb_tbs, nb_tbs > 0 ?
> >            ((unsigned long)(tcg_ctx.code_gen_ptr - 
> > tcg_ctx.code_gen_buffer)) /
> >-           tcg_ctx.tb_ctx.nb_tbs : 0);
> >+           nb_tbs : 0);
> > #endif
> 
> Variable declaration within braces within the ifdef.  Better as size_t or
> unsigned long.  Using int to count thing on 64-bit hosts always seems like a
> bug.

g_tree_nnodes returns a gint, which is documented to be a typedef for 'int'.
So I went with that.

But yes, a size_t here is better.

                E.



reply via email to

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