From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUSle-0004Yk-4H for qemu-devel@nongnu.org; Sun, 30 Mar 2014 23:20:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WUSlV-0001d9-2Y for qemu-devel@nongnu.org; Sun, 30 Mar 2014 23:20:10 -0400 Received: from mail-pa0-x234.google.com ([2607:f8b0:400e:c03::234]:36889) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WUSlU-0001d1-Rx for qemu-devel@nongnu.org; Sun, 30 Mar 2014 23:20:00 -0400 Received: by mail-pa0-f52.google.com with SMTP id rd3so7577287pab.39 for ; Sun, 30 Mar 2014 20:19:59 -0700 (PDT) Sender: Richard Henderson Message-ID: <5338DEC1.5050906@twiddle.net> Date: Sun, 30 Mar 2014 20:19:29 -0700 From: Richard Henderson MIME-Version: 1.0 References: <1396052834-26834-1-git-send-email-rth@twiddle.net> <533838C8.80307@twiddle.net> In-Reply-To: <533838C8.80307@twiddle.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/8] tcg: tidy the type of code_ptr List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: QEMU Developers , Aurelien Jarno On 03/30/2014 08:31 AM, Richard Henderson wrote: > On 03/29/2014 01:26 PM, Peter Maydell wrote: >> It seems like it might be worth abstracting out "give me the byte >> difference between these two code pointers" rather than having >> inline (uintptr_t)codeptr1 - (uintptr_t)codeptr2, but I dunno. > > Yeah, I dithered about that. I couldn't come up with a good name that > adequately described what I wanted that was really any shorter than just having > the casts. static inline ptrdiff_t tcg_ptr_byte_diff(void *a, void *b) { return a - b; } static inline ptrdiff_t tcg_pcrel_diff(TCGContext *s, void *target) { return tcg_ptr_byte_diff(target, s->code_ptr); } static inline size_t tcg_current_code_size(TCGContext *s) { return tcg_ptr_byte_diff(s->code_ptr, s->code_buf); } >> Is there a better name than 'tcg_itype' ? Putting 'type' in the >> name of a type is a bit redundant, and suggests it contains >> a type rather than an insn. > > I'm open to suggestions there as well. On x86 and ia64, it won't hold an > entire insn, so "tcg_insn" seemed inappropriate. tcg_{isa,insn}_{part,elt} ? r~