|
The difference is not directly related to stack-based, but it is related
in an indirect way. One of the advantages of stack-based implementations
is that opcodes are small (typically one byte), because most operands
are implicit (top of the stack). However, several instructions still
need explicit operands (e.g., goto, branch, call), and typically these
operands need more than one byte.
On the other hand, because register-based instructions need explicit
operands for most (all?) operations, it makes sense to use a longer
instruction format (Lua uses 32-bit instructions). With these longer
instructions, fetching explicit operands is cheaper.