lua-users home
lua-l archive

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

> In a stack based VM (and I think in the pre 5.x lua version) an
> efficient way to pass parameters between function calls is via frame
> overlapping.
> Since Lua 5 is register based I think that this method cannot be used,
> so how Lua pass parameters? And how a return value can be stored in
> the right caller register?

It uses the same method. You store the arguments in a sequence of free
registers (such that no higher register is being used) and call the
function; those registers with the arguments become the first registers
of the called function.  (Real CPUs can do that too, using register
windows [1].)


-- Roberto