[LLVMdev] Tail Call Optimisation

Simon Harris haruki.zaemon at gmail.com
Sun Jan 3 19:37:39 PST 2010


On 04/01/2010, at 3:50 PM, Jon Harrop wrote:

> On Monday 04 January 2010 03:33:06 Simon Harris wrote:
>> On 04/01/2010, at 3:01 PM, Jon Harrop wrote:
>>> I am certainly interested in tail calls because my HLVM project relies
>>> upon LLVM's tail call elimination. However, I do not understand what tail
>>> calls LLVM is not currently eliminating that you plan to eliminate?
>> 
>> Mutual recursion for a start:
>> 
>> def a(n)
>>  n <= 0 ? "DONE" : b(n - 1)
>> end
>> 
>> def b(n)
>>  n <= 0 ? "DONE" : a(n - 1)
>> end
>> 
>> a(10000000)
>> 
>> Boom!
> 
> LLVM's TCO already handles mutual recursion.

Hmm... OK. Perhaps it's the way it's being used by MacRuby and Rubinius. Drat!

Back to the drawing board :(





More information about the llvm-dev mailing list