hopibel
hopibel

Reputation: 1

Why does LuaJIT bytecode put the opcode at the end instead of the front?

I've been reading up on virtual machines for interpreted languages. Usually the bytecode format is something like Opcode : Operand/s but with LuaJIT it's the reverse:

http://wiki.luajit.org/Bytecode-2.0

A single bytecode instruction is 32 bit wide and has an 8 bit opcode field and several operand fields of 8 or 16 bit. Instructions come in one of two formats:

B | C | A | OP  
  D   | A | OP

Where OP is the opcode and A,B,C,D are operands

My question: Why is LuaJIT different here? Is there some benefit to this order (byte alignment maybe?) or is it an arbitrary design choice?

Upvotes: 0

Views: 484

Answers (0)

Related Questions