[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Disabling tail calls
- From: Ico <lua@...>
- Date: Thu, 30 Sep 2010 20:26:39 +0200
* On 2010-09-30 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote :
> > My current solution is to have a patched lua interpreter/compiler at hand with
> > a small modification to treat OP_TAILCALL simply as OP_CALL
>
> Isn't it enough to disable the line below in retstat (lparser.c:1251)?
> SET_OPCODE(getcode(fs,&e), OP_TAILCALL);
> This prevents the parser from generating tail calls.
Also possible.
> If you have precompiled code that uses tail calls, then you'll probably
> have to delete the whole case OP_TAILCALL in lvm.c and have OP_TAILCALL
> be handled by OP_CALL.
Which is exactly what I did.
This works well for me and helps me with my problem, but it still
requires a compile time decision to enable or disable tail calls. I was
wondering if the original idea - making this run-time switchable, as
proposed by Rici Lake - would be a viable feature for Lua.
--
:wq
^X^Cy^K^X^C^C^C^C