lua-users home
lua-l archive

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


Hi, list

The opcode is made up of 7 bits.
But there are 8 bits(including MM) for luaP_opmodes on Lua5.4.1 and 7
bits on Lua5.1(no MM).
What are the functions of the MM?
Does this bit belong to opcode?
I would be grateful to have some help with this question.
Thank you for your attention to my question.

Here are the related code snippets:
/*Lua 5.4.1*/
  We assume that instructions are unsigned 32-bit integers.
  All instructions have an opcode in the first 7 bits.
  Instructions can have the following formats:

        3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0
        1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
iABC          C(8)     |      B(8)     |k|     A(8)      |   Op(7)     |

/*Lua 5.4.1*/
LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
/*       MM OT IT T  A  mode       opcode  */
  opmode(0, 0, 0, 0, 1, iABC)   /* OP_MOVE */
 ,opmode(0, 0, 0, 0, 1, iAsBx)    /* OP_LOADI */
 ,opmode(0, 0, 0, 0, 1, iAsBx)    /* OP_LOADF */
...
}

/*Lua 5.1*/
const lu_byte luaP_opmodes(NUM_OPCODES) = {
            /* T A       B           C         mode    opcode */
opmode(O, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */
opmode(o, 1, OpArgK, OpArgN, iABx) /* OP LOADK */
...
}

Best regards
Sunshilong