diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-06 14:14:11 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-09-06 14:14:11 -0300 |
| commit | 4518e5df24600cacdb3bab75d640348d28e8b769 (patch) | |
| tree | c9e8c678e718b5ccec7e7ca120bd68c5634bdfda /lopcodes.h | |
| parent | 72a094bda7d71050a91a88474d67d39aa2bc1c46 (diff) | |
| download | lua-4518e5df24600cacdb3bab75d640348d28e8b769.tar.gz lua-4518e5df24600cacdb3bab75d640348d28e8b769.tar.bz2 lua-4518e5df24600cacdb3bab75d640348d28e8b769.zip | |
Added macro 'testMMMode'
Macro 'testMMMode' checks whether opcode is an MM opcode.
Diffstat (limited to 'lopcodes.h')
| -rw-r--r-- | lopcodes.h | 5 |
1 files changed, 4 insertions, 1 deletions
| @@ -359,6 +359,7 @@ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ | |||
| 359 | ** bit 4: operator is a test (next instruction must be a jump) | 359 | ** bit 4: operator is a test (next instruction must be a jump) |
| 360 | ** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0) | 360 | ** bit 5: instruction uses 'L->top' set by previous instruction (when B == 0) |
| 361 | ** bit 6: instruction sets 'L->top' for next instruction (when C == 0) | 361 | ** bit 6: instruction sets 'L->top' for next instruction (when C == 0) |
| 362 | ** bit 7: instruction is an MM instruction (call a metamethod) | ||
| 362 | */ | 363 | */ |
| 363 | 364 | ||
| 364 | LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) | 365 | LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) |
| @@ -368,6 +369,7 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) | |||
| 368 | #define testTMode(m) (luaP_opmodes[m] & (1 << 4)) | 369 | #define testTMode(m) (luaP_opmodes[m] & (1 << 4)) |
| 369 | #define testITMode(m) (luaP_opmodes[m] & (1 << 5)) | 370 | #define testITMode(m) (luaP_opmodes[m] & (1 << 5)) |
| 370 | #define testOTMode(m) (luaP_opmodes[m] & (1 << 6)) | 371 | #define testOTMode(m) (luaP_opmodes[m] & (1 << 6)) |
| 372 | #define testMMMode(m) (luaP_opmodes[m] & (1 << 7)) | ||
| 371 | 373 | ||
| 372 | /* "out top" (set top for next instruction) */ | 374 | /* "out top" (set top for next instruction) */ |
| 373 | #define isOT(i) \ | 375 | #define isOT(i) \ |
| @@ -377,7 +379,8 @@ LUAI_DDEC(const lu_byte luaP_opmodes[NUM_OPCODES];) | |||
| 377 | /* "in top" (uses top from previous instruction) */ | 379 | /* "in top" (uses top from previous instruction) */ |
| 378 | #define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0) | 380 | #define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0) |
| 379 | 381 | ||
| 380 | #define opmode(ot,it,t,a,m) (((ot)<<6) | ((it)<<5) | ((t)<<4) | ((a)<<3) | (m)) | 382 | #define opmode(mm,ot,it,t,a,m) \ |
| 383 | (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m)) | ||
| 381 | 384 | ||
| 382 | 385 | ||
| 383 | /* number of list items to accumulate before a SETLIST instruction */ | 386 | /* number of list items to accumulate before a SETLIST instruction */ |
