[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 |
Hello,
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)
.L:
i5 = i1 == i2
if i1 != i2 then goto .L0
.L:
return_int(i1)
ends_in_dead
.L0:
i6 = ilt_un(i1, i2)
if ige_un(i1, i2) then goto .L1
.L:
i7 = i2 - i1
i8 = i1
i1 = i8
i2 = i7
goto .L2 // <-- Shouldn't it go back to L?
ends_in_dead
.L1: .L3: .L2:
i9 = i1 - i2
i10 = i2
i1 = i9
i2 = i10
goto .L4 // <-- Shouldn't it go back to L?
ends_in_dead
.L5: .L4:
.L:
end
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
2014).
> I am on ArchLinux x86_64.
> Is there anything wrong in the code of the tutorial 5 or is this a bug?
> Thanks.
signature.asc
Description: OpenPGP digital signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Libjit] Tail Call not Working,
Niklas Fiekas <=