[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Tail call benchmarks
- From: "Alex Davies" <alex.mania@...>
- Date: Mon, 23 Feb 2009 19:18:48 +0900
Wim Couwenberg wrote:
It would be great if tail calls could be made cheaper.
A jiter could easily recognise this special case of tail call recursion,
converting it back in to a for/while loop. (The intermediate code would end
up virtually identical), although tail calls in raw Lua can't really be
If you really need it though, you could possibly write a function which'd
modify the bytecode to remove the tailcall (and convert it in to a jump,
loadnil and moves) but it'd be messy (it's a lot more complex then it
sounds - you have to detect constant functions) and it wouldn't work with
the debug library.