lua-users home
lua-l archive

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

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.

Stack-based is smaller instructions than register-based's  but it sometimes requires explict operands which is likely multi byte (e,g, JVM's goto and branch). right? 
I got it, Thank you!

Kawahara Satoru
College of Information Science
University of Tsukuba