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 10:11:13 -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:
>>      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?
> 

Replaced thus:

diff --git a/tcg/tcg.c b/tcg/tcg.c
index a835632..0b0be45 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -2683,8 +2683,7 @@ static inline int tcg_gen_code_common(TCGContext *s,
         }
         args += def->nb_args;
     next:
-        if (search_pc >= 0
-            && search_pc < (intptr_t)s->code_ptr - (intptr_t)gen_code_buf) {
+        if (search_pc >= 0 && search_pc < tcg_current_code_size(s)) {
             return op_index;
         }
         op_index++;



r~



reply via email to

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