31 enum OpMode {iABC, iABx, iAsBx};
39 #define SIZE_Bx (SIZE_C + SIZE_B) 45 #define POS_A (POS_OP + SIZE_OP) 46 #define POS_C (POS_A + SIZE_A) 47 #define POS_B (POS_C + SIZE_C) 56 #if SIZE_Bx < LUAI_BITSINT-1 57 #define MAXARG_Bx ((1<<SIZE_Bx)-1) 58 #define MAXARG_sBx (MAXARG_Bx>>1) 60 #define MAXARG_Bx MAX_INT 61 #define MAXARG_sBx MAX_INT 65 #define MAXARG_A ((1<<SIZE_A)-1) 66 #define MAXARG_B ((1<<SIZE_B)-1) 67 #define MAXARG_C ((1<<SIZE_C)-1) 71 #define MASK1(n,p) ((~((~(Instruction)0)<<n))<<p) 74 #define MASK0(n,p) (~MASK1(n,p)) 80 #define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0))) 81 #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ 82 ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP)))) 84 #define GETARG_A(i) (cast(int, ((i)>>POS_A) & MASK1(SIZE_A,0))) 85 #define SETARG_A(i,u) ((i) = (((i)&MASK0(SIZE_A,POS_A)) | \ 86 ((cast(Instruction, u)<<POS_A)&MASK1(SIZE_A,POS_A)))) 88 #define GETARG_B(i) (cast(int, ((i)>>POS_B) & MASK1(SIZE_B,0))) 89 #define SETARG_B(i,b) ((i) = (((i)&MASK0(SIZE_B,POS_B)) | \ 90 ((cast(Instruction, b)<<POS_B)&MASK1(SIZE_B,POS_B)))) 92 #define GETARG_C(i) (cast(int, ((i)>>POS_C) & MASK1(SIZE_C,0))) 93 #define SETARG_C(i,b) ((i) = (((i)&MASK0(SIZE_C,POS_C)) | \ 94 ((cast(Instruction, b)<<POS_C)&MASK1(SIZE_C,POS_C)))) 96 #define GETARG_Bx(i) (cast(int, ((i)>>POS_Bx) & MASK1(SIZE_Bx,0))) 97 #define SETARG_Bx(i,b) ((i) = (((i)&MASK0(SIZE_Bx,POS_Bx)) | \ 98 ((cast(Instruction, b)<<POS_Bx)&MASK1(SIZE_Bx,POS_Bx)))) 100 #define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx) 101 #define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx)) 104 #define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \ 105 | (cast(Instruction, a)<<POS_A) \ 106 | (cast(Instruction, b)<<POS_B) \ 107 | (cast(Instruction, c)<<POS_C)) 109 #define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \ 110 | (cast(Instruction, a)<<POS_A) \ 111 | (cast(Instruction, bc)<<POS_Bx)) 119 #define BITRK (1 << (SIZE_B - 1)) 122 #define ISK(x) ((x) & BITRK) 125 #define INDEXK(r) ((int)(r) & ~BITRK) 127 #define MAXINDEXRK (BITRK - 1) 130 #define RKASK(x) ((x) | BITRK) 136 #define NO_REG MAXARG_A 211 #define NUM_OPCODES (cast(int, OP_VARARG) + 1) 252 LUAI_DATA
const lu_byte luaP_opmodes[NUM_OPCODES];
254 #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3)) 255 #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3)) 256 #define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) 257 #define testAMode(m) (luaP_opmodes[m] & (1 << 6)) 258 #define testTMode(m) (luaP_opmodes[m] & (1 << 7)) 261 LUAI_DATA
const char *
const luaP_opnames[NUM_OPCODES+1];
265 #define LFIELDS_PER_FLUSH 50