From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLo6d-0005Jy-PY for qemu-devel@nongnu.org; Wed, 10 Oct 2012 00:41:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TLo6c-0005VS-JP for qemu-devel@nongnu.org; Wed, 10 Oct 2012 00:41:15 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:21299) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TLo6c-0005V2-7g for qemu-devel@nongnu.org; Wed, 10 Oct 2012 00:41:14 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MBN00D5VUC703K0@mailout4.samsung.com> for qemu-devel@nongnu.org; Wed, 10 Oct 2012 13:41:10 +0900 (KST) Received: from [172.21.111.108] ([182.198.1.3]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MBN00G51UCM6B80@mmp2.samsung.com> for qemu-devel@nongnu.org; Wed, 10 Oct 2012 13:41:10 +0900 (KST) Date: Wed, 10 Oct 2012 13:41:27 +0900 From: Yeongkyoon Lee In-reply-to: <507471C6.6010003@twiddle.net> Message-id: <5074FC77.8010407@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8; format=flowed Content-transfer-encoding: QUOTED-PRINTABLE References: <1349786252-12343-1-git-send-email-yeongkyoon.lee@samsung.com> <1349786252-12343-4-git-send-email-yeongkyoon.lee@samsung.com> <507471C6.6010003@twiddle.net> Subject: Re: [Qemu-devel] [PATCH v5 3/3] tcg: Optimize qemu_ld/st by generating slow paths at the end of a block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org On 2012=EB=85=84 10=EC=9B=94 10=EC=9D=BC 03:49, Richard Henderson wro= te: > On 10/09/2012 05:37 AM, Yeongkyoon Lee wrote: >> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION) && defined(CONFIG_SOFT= MMU) >> + /* Initialize qemu_ld/st labels to assist code generation at = the end of TB >> + for TLB miss cases at the end of TB */ >> + s->qemu_ldst_labels =3D tcg_malloc(sizeof(TCGLabelQemuLdst) * >> + TCG_MAX_QEMU_LDST); >> + s->nb_qemu_ldst_labels =3D 0; >> +#endif > I said before that I wasn't fond of this sort of "constant" dynamic= allocation. > Regardless of what surrounding code does. You could clean those up= too, > as a separate patch... I can change the dynamic allocation to static one as you said, howeve= r,=20 one concern is that we might use redundant memory on non-TCG=20 environment, such as, KVM mode. What's you opinion about this? > >> +#if defined(CONFIG_QEMU_LDST_OPTIMIZATION) && defined(CONFIG_SOFT= MMU) >> + /* Generate slow paths of qemu_ld/st IRs which call MMU helpe= rs at >> + the end of block */ >> + tcg_out_qemu_ldst_slow_path(s); >> +#endif > This interface is so close to "tcg_out_ldst_and_constant_pools(s)" = that > I don't think the function should be specific to ldst. Just call i= t > tcg_out_tb_finalize or something. That looks good. I'll do refactoring for the function names later. > >> +/* Macros/structures for qemu_ld/st IR code optimization: >> + TCG_MAX_HELPER_LABELS is defined as same as OPC_BUF_SIZE in ex= ec-all.h. */ >> +#define TCG_MAX_QEMU_LDST 640 >> +#define HL_LDST_SHIFT 4 >> +#define HL_LDST_MASK (1 << HL_LDST_SHIFT) >> +#define HL_ST_MASK HL_LDST_MASK >> +#define HL_OPC_MASK (HL_LDST_MASK - 1) >> +#define IS_QEMU_LD_LABEL(L) (!((L)->opc_ext & HL_LDST_MASK)) >> +#define IS_QEMU_ST_LABEL(L) ((L)->opc_ext & HL_LDST_MASK) >> + >> +typedef struct TCGLabelQemuLdst { >> + int opc_ext; /* | 27bit(reserved) | 1bit(ld/st) | = 4bit(opc) | */ > Any good reason to use all these masks when the compiler can do it > for you with bitfields? No. It is just my coding style. However, there might be no compiler problems and bitfields might look= =20 somewhat pretty, so I'll use bitfields later. > > > r~ >