lua-users home
lua-l archive

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


> The 'top' field in CallInfo. Is this always 'base' +
> 'Proto.maxstacksize'  ? Is this fixed at the time of the function
> entry or can the 'top' change during execution?

Of course it changes every time the function calls another function,
so every return to the function must set 'top' again (see your last
message). The only exception to this rule is for undefined multiple
returns (an "open call"), like in '{f()}'. In that case, OP_CALL leaves
'top' unchanged to indicate how many values were returned, and the next
instruction, 'OP_SETLIST', uses it and then corrects it.


> The 'maxstacksize' in Proto - is this fixed when the function is
> compiled or can it change over time? What does it take into account?

You can find that out for yourself, can't you? 'grep maxstacksize l*.c'
shows you all (four) locations where this value is assigned.

-- Roberto