Added macro 'testMMMode'

Macro 'testMMMode' checks whether opcode is an MM opcode.
This commit is contained in:
Roberto Ierusalimschy
2019-09-06 14:14:11 -03:00
parent 72a094bda7
commit 4518e5df24
3 changed files with 95 additions and 94 deletions

View File

@@ -359,6 +359,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
** bit 4: operator is a test (next instruction must be a jump)
** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0)
** bit 6: instruction sets 'L->top' for next instruction (when C == 0)
** bit 7: instruction is an MM instruction (call a metamethod)
*/
LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];)
@@ -368,6 +369,7 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];)
#define testTMode(m) (luaP_opmodes[m] & (1 << 4))
#define testITMode(m) (luaP_opmodes[m] & (1 << 5))
#define testOTMode(m) (luaP_opmodes[m] & (1 << 6))
#define testMMMode(m) (luaP_opmodes[m] & (1 << 7))
/* "out top" (set top for next instruction) */
#define isOT(i) \
@@ -377,7 +379,8 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];)
/* "in top" (uses top from previous instruction) */
#define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)
#define opmode(ot,it,t,a,m) (((ot)<<6) | ((it)<<5) | ((t)<<4) | ((a)<<3) | (m))
#define opmode(mm,ot,it,t,a,m) \
(((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))
/* number of list items to accumulate before a SETLIST instruction */