Y
Hacker News
new
|
ask
|
show
|
jobs
by
s_baby
4839 days ago
I thought Lua used a register based VM.
1 comments
wereHamster
4839 days ago
No, it's a stack machine. See
http://www.lua.org/manual/5.1/manual.html#3
link
munificent
4839 days ago
You're both right. It has a stack that it uses for callframes and local variables, but the opcodes have operands to directly reference variables on it by index. In other words, it treats all of the stack for a given callframe as a set of registers.
link
LeafStorm
4839 days ago
The stack is an abstraction used in the C API. If you look at the actual bytecode generated, it's all register-based.
link