qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3 05/16] tcg: Define tcg_insn_unit for codepoin


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v3 05/16] tcg: Define tcg_insn_unit for codepointerss
Date: Tue, 29 Apr 2014 07:20:21 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 04/29/2014 03:38 AM, Alex Bennée wrote:
>> @@ -2653,7 +2683,8 @@ static inline int tcg_gen_code_common(TCGContext *s, 
>> uint8_t *gen_code_buf,
>>          }
>>          args += def->nb_args;
>>      next:
>> -        if (search_pc >= 0 && search_pc < s->code_ptr - gen_code_buf) {
>> +        if (search_pc >= 0
>> +            && search_pc < (intptr_t)s->code_ptr - (intptr_t)gen_code_buf) {
>>              return op_index;
>>          }
> 
> I thought we were trying to avoid excessive casting with pointer
> arithmetic? Can this be made neater?

Yes, incomplete conversion to the helpers.  Will fix.

>> +#ifndef TCG_TARGET_INSN_UNIT_SIZE
>> +#define TCG_TARGET_INSN_UNIT_SIZE 1
>> +#endif
>> +#if TCG_TARGET_INSN_UNIT_SIZE == 1
>> +typedef uint8_t tcg_insn_unit;
>> +#elif TCG_TARGET_INSN_UNIT_SIZE == 2
>> +typedef uint16_t tcg_insn_unit;
>> +#elif TCG_TARGET_INSN_UNIT_SIZE == 4
>> +typedef uint32_t tcg_insn_unit;
>> +#elif TCG_TARGET_INSN_UNIT_SIZE == 8
>> +typedef uint64_t tcg_insn_unit;
>> +#else
>> +/* The port better have done this.  */
> 
> Shouldn't we #error if the port hasn't done this then?

The compiler will error very shortly if this hasn't been done,
since we'll use the type in a declaration below.  But, no,
there is no way to #error here.


r~




reply via email to

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