[Top][All Lists]

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

[Libjit] Tail Call not Working

From: Niklas Fiekas
Subject: [Libjit] Tail Call not Working
Date: Tue, 27 Jan 2015 13:28:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0


some additional information:

 * I can reproduce this problem and the wrong result 8 on x86.

 * If I configure with --enable-interpreter it even
   segfaults in _jit_run_function.

This is the dump of the generated code:

function gcd(i1 : uint, i2 : uint) : uint
        incoming_reg(i1, rdi)
        incoming_reg(i2, rsi)
        i5 = i1 == i2
        if i1 != i2 then goto .L0
        i6 = ilt_un(i1, i2)
        if ige_un(i1, i2) then goto .L1
        i7 = i2 - i1
        i8 = i1
        i1 = i8
        i2 = i7
        goto .L2 // <-- Shouldn't it go back to L?
.L1: .L3: .L2:
        i9 = i1 - i2
        i10 = i2
        i1 = i9
        i2 = i10
        goto .L4 // <-- Shouldn't it go back to L?
.L5: .L4:

If I understand this correctly, it does not jump
to the start of the gcd function, when it should.

Best regards
Niklas Fiekas

> From: Antoni Boucher
> Hello.
> The tail call flag of the jit_insn_call() function does not seem to
> work.
> If I launch the tutorial 5 code, I get the following output:
> gcd(27, 14) = 8
> which is clearly wrong.
> Even with other arguments, the answer seems to be always 8.
> I compiled the tutorial 5 with the latest git revision (from june 18th
> I am on ArchLinux x86_64.
> Is there anything wrong in the code of the tutorial 5 or is this a bug?
> Thanks.

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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