dotgnu-libjit
[Top][All Lists]
Advanced

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

Re: [Dotgnu-libjit] Possible Libjit bug


From: Simone Campanoni
Subject: Re: [Dotgnu-libjit] Possible Libjit bug
Date: Thu, 21 Oct 2010 12:31:04 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.11) Gecko/20101006 Thunderbird/3.1.5

Hi Klaus,
    I have applied your suggestions and everything works fine.
The patch is the following:

--- libjit/jit/jit-reg-alloc.c  2010-09-21 14:12:14.806725047 -0400
+++ libjitNew//jit/jit-reg-alloc.c      2010-10-21 10:08:38.976750000 -0400
@@ -2746,6 +2746,7 @@
                        --reg;
                }
                candidates[index]->has_global_register = 1;
+               candidates[index]->in_global_register = 1;
                candidates[index]->global_reg = (short)reg;
                jit_reg_set_used(gen->touched, reg);
                jit_reg_set_used(gen->permanent, reg);


Thanks,
simone


On 09/30/2010 02:54 PM, Klaus Treichel wrote:
> Hi Simone,
>
> i think i know what the problem is.
>
> The problematic value has been assigned to a global register.
> In your libjittest_incorrect sample the value is used before a value was
> assigned to the register (from the program order view and not the
> program flow view).
> So the in_global_register flag is still 0 even if it should be 1 at the
> start of each block.
>
> At the end of each block the values are spilled back to the global
> registers anyways so this should be ok.
>
> The change would be setting in_global_register = 1 where
> has_global_register is set to 1 too (in _jit_regs_alloc_global).
>
> Looks like this problem is not x86 specific.
>  
> @Aleksey: What do you think?
>
> Cheers,
> Klaus
>
> Am Mittwoch, den 29.09.2010, 15:28 -0400 schrieb Simone Campanoni:
>> Hi all,
>>     I would like to show a possible bug of Libjit I have found in the
>> attached examples.
>> I am using Libjit from the git repository and the Intel x86 back-end.
>>
>> The program libjittest_correct.c and libjittest_incorrect.c should have
>> the same behavior and they should return zero as output.
>> If you try to compile them, you will find an incorrect execution of
>> libjittest_incorrect.c (it will return 1 instead of 0).
>>
>> My guess is that the error is within the usage of global registers of
>> x86 back-end.
>>
>> I hope you will find this useful to improve the Libjit library.
>>
>> Thanks for your work,
>> Simone Campanoni
>> _______________________________________________
>> Dotgnu-libjit mailing list
>> address@hidden
>> http://lists.gnu.org/mailman/listinfo/dotgnu-libjit



reply via email to

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