lua-users home
lua-l archive

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


On 14 December 2015 at 17:25, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
>> My questions are:
>> a) What does luaK_dischargevars() do?
>
> Code generation for several kinds of expressions is delayed until Lua
> knows what it will do with that expression. (For instance, an access
> to an upvalue does not immediately create a OP_GETUPVAL instruction,
> because table access can use OP_GETTABUP directly.)
>

Thanks for the explanation Roberto. I did wonder if there was a bit of
optimization going on in some cases. I have tried to step through the
code in the debugger but the problem is that Lua itself executes Lua
code before one can get to the code of interest. So there is just too
much noise to be able to see what is going on.

I guess that the only way for me to completely understand is to write
a code generator myself - which I might do next year just as an
exercise as I don't think one can beat the efficiency of the current
approach.

Regards
Dibyendu