qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 0/8] tcg: tidy the type of code_ptr


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 0/8] tcg: tidy the type of code_ptr
Date: Sun, 30 Mar 2014 20:19:29 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

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~




reply via email to

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