浏览该文件的文档.
40 #define SIZE_Bx (SIZE_C + SIZE_B + 1)
42 #define SIZE_Ax (SIZE_Bx + SIZE_A)
43 #define SIZE_sJ (SIZE_Bx + SIZE_A)
49 #define POS_A (POS_OP + SIZE_OP)
50 #define POS_k (POS_A + SIZE_A)
51 #define POS_B (POS_k + 1)
52 #define POS_C (POS_B + SIZE_B)
68 #define L_INTHASBITS(b) ((UINT_MAX >> ((b) - 1)) >= 1)
71 #if L_INTHASBITS(SIZE_Bx)
72 #define MAXARG_Bx ((1<<SIZE_Bx)-1)
74 #define MAXARG_Bx MAX_INT
77 #define OFFSET_sBx (MAXARG_Bx>>1)
80 #if L_INTHASBITS(SIZE_Ax)
81 #define MAXARG_Ax ((1<<SIZE_Ax)-1)
83 #define MAXARG_Ax MAX_INT
86 #if L_INTHASBITS(SIZE_sJ)
87 #define MAXARG_sJ ((1 << SIZE_sJ) - 1)
89 #define MAXARG_sJ MAX_INT
92 #define OFFSET_sJ (MAXARG_sJ >> 1)
95 #define MAXARG_A ((1<<SIZE_A)-1)
96 #define MAXARG_B ((1<<SIZE_B)-1)
97 #define MAXARG_C ((1<<SIZE_C)-1)
98 #define OFFSET_sC (MAXARG_C >> 1)
100 #define int2sC(i) ((i) + OFFSET_sC)
101 #define sC2int(i) ((i) - OFFSET_sC)
105 #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p))
108 #define MASK0(n,p) (~MASK1(n,p))
114 #define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
115 #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
116 ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
118 #define checkopm(i,m) (getOpMode(GET_OPCODE(i)) == m)
121 #define getarg(i,pos,size) (cast_int(((i)>>(pos)) & MASK1(size,0)))
122 #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
123 ((cast(Instruction, v)<<pos)&MASK1(size,pos))))
125 #define GETARG_A(i) getarg(i, POS_A, SIZE_A)
126 #define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
128 #define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B))
129 #define GETARG_sB(i) sC2int(GETARG_B(i))
130 #define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
132 #define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C))
133 #define GETARG_sC(i) sC2int(GETARG_C(i))
134 #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
136 #define TESTARG_k(i) check_exp(checkopm(i, iABC), (cast_int(((i) & (1u << POS_k)))))
137 #define GETARG_k(i) check_exp(checkopm(i, iABC), getarg(i, POS_k, 1))
138 #define SETARG_k(i,v) setarg(i, v, POS_k, 1)
140 #define GETARG_Bx(i) check_exp(checkopm(i, iABx), getarg(i, POS_Bx, SIZE_Bx))
141 #define SETARG_Bx(i,v) setarg(i, v, POS_Bx, SIZE_Bx)
143 #define GETARG_Ax(i) check_exp(checkopm(i, iAx), getarg(i, POS_Ax, SIZE_Ax))
144 #define SETARG_Ax(i,v) setarg(i, v, POS_Ax, SIZE_Ax)
146 #define GETARG_sBx(i) \
147 check_exp(checkopm(i, iAsBx), getarg(i, POS_Bx, SIZE_Bx) - OFFSET_sBx)
148 #define SETARG_sBx(i,b) SETARG_Bx((i),cast_uint((b)+OFFSET_sBx))
150 #define GETARG_sJ(i) \
151 check_exp(checkopm(i, isJ), getarg(i, POS_sJ, SIZE_sJ) - OFFSET_sJ)
152 #define SETARG_sJ(i,j) \
153 setarg(i, cast_uint((j)+OFFSET_sJ), POS_sJ, SIZE_sJ)
156 #define CREATE_ABCk(o,a,b,c,k) ((cast(Instruction, o)<<POS_OP) \
157 | (cast(Instruction, a)<<POS_A) \
158 | (cast(Instruction, b)<<POS_B) \
159 | (cast(Instruction, c)<<POS_C) \
160 | (cast(Instruction, k)<<POS_k))
162 #define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
163 | (cast(Instruction, a)<<POS_A) \
164 | (cast(Instruction, bc)<<POS_Bx))
166 #define CREATE_Ax(o,a) ((cast(Instruction, o)<<POS_OP) \
167 | (cast(Instruction, a)<<POS_Ax))
169 #define CREATE_sJ(o,j,k) ((cast(Instruction, o) << POS_OP) \
170 | (cast(Instruction, j) << POS_sJ) \
171 | (cast(Instruction, k) << POS_k))
174 #if !defined(MAXINDEXRK)
175 #define MAXINDEXRK MAXARG_B
182 #define NO_REG MAXARG_A
312 #define NUM_OPCODES ((int)(OP_EXTRAARG) + 1)
372 #define testTMode(m) (luaP_opmodes[m] & (1 << 4))
373 #define testITMode(m) (luaP_opmodes[m] & (1 << 5))
374 #define testOTMode(m) (luaP_opmodes[m] & (1 << 6))
375 #define testMMMode(m) (luaP_opmodes[m] & (1 << 7))
379 ((testOTMode(GET_OPCODE(i)) && GETARG_C(i) == 0) || \
380 GET_OPCODE(i) == OP_TAILCALL)
383 #define isIT(i) (testITMode(GET_OPCODE(i)) && GETARG_B(i) == 0)
385 #define opmode(mm,ot,it,t,a,m) \
386 (((mm) << 7) | ((ot) << 6) | ((it) << 5) | ((t) << 4) | ((a) << 3) | (m))
390 #define LFIELDS_PER_FLUSH 50
@ OP_SETLIST
Definition: lopcodes.h:300
@ OP_MODK
Definition: lopcodes.h:231
@ OP_VARARG
Definition: lopcodes.h:304
@ OP_SELF
Definition: lopcodes.h:224
#define cast(t, exp)
Definition: llimits.h:123
@ OP_TFORPREP
Definition: lopcodes.h:296
@ OP_TAILCALL
Definition: lopcodes.h:286
@ OP_CALL
Definition: lopcodes.h:285
@ OP_SHR
Definition: lopcodes.h:255
@ OP_ADDI
Definition: lopcodes.h:226
@ OP_GETUPVAL
Definition: lopcodes.h:209
@ OP_FORLOOP
Definition: lopcodes.h:292
@ OP_CONCAT
Definition: lopcodes.h:266
@ OP_IDIVK
Definition: lopcodes.h:234
@ OP_BNOT
Definition: lopcodes.h:262
@ OP_LOADTRUE
Definition: lopcodes.h:207
@ OP_LTI
Definition: lopcodes.h:277
@ OP_BXORK
Definition: lopcodes.h:238
@ iABx
Definition: lopcodes.h:32
@ OP_LOADI
Definition: lopcodes.h:201
@ OP_LE
Definition: lopcodes.h:273
@ OP_LOADF
Definition: lopcodes.h:202
@ OP_SUBK
Definition: lopcodes.h:229
@ OP_LOADFALSE
Definition: lopcodes.h:205
@ OP_UNM
Definition: lopcodes.h:261
@ OP_MOVE
Definition: lopcodes.h:200
#define LUAI_DDEF
Definition: luaconf.h:311
@ OP_DIV
Definition: lopcodes.h:248
@ OP_CLOSE
Definition: lopcodes.h:268
@ OP_GETI
Definition: lopcodes.h:214
@ OP_NOT
Definition: lopcodes.h:263
@ OP_TFORLOOP
Definition: lopcodes.h:298
@ OP_SETI
Definition: lopcodes.h:219
@ OP_EXTRAARG
Definition: lopcodes.h:308
@ OP_GEI
Definition: lopcodes.h:280
@ OP_MMBINI
Definition: lopcodes.h:258
@ OP_CLOSURE
Definition: lopcodes.h:302
@ OP_RETURN0
Definition: lopcodes.h:289
@ OP_DIVK
Definition: lopcodes.h:233
@ OP_SETTABLE
Definition: lopcodes.h:218
@ OP_SHRI
Definition: lopcodes.h:240
unsigned char lu_byte
Definition: llimits.h:36
@ OP_TBC
Definition: lopcodes.h:269
@ OP_IDIV
Definition: lopcodes.h:249
@ OP_VARARGPREP
Definition: lopcodes.h:306
@ OP_ADD
Definition: lopcodes.h:243
@ OP_MOD
Definition: lopcodes.h:246
@ OP_EQK
Definition: lopcodes.h:275
@ OP_BXOR
Definition: lopcodes.h:253
@ OP_SHLI
Definition: lopcodes.h:241
@ OP_EQI
Definition: lopcodes.h:276
@ OP_LOADK
Definition: lopcodes.h:203
@ OP_MUL
Definition: lopcodes.h:245
@ OP_BANDK
Definition: lopcodes.h:236
@ OP_BORK
Definition: lopcodes.h:237
OpMode
Definition: lopcodes.h:32
@ iABC
Definition: lopcodes.h:32
@ OP_GETFIELD
Definition: lopcodes.h:215
@ OP_BOR
Definition: lopcodes.h:252
@ OP_LEN
Definition: lopcodes.h:264
@ OP_SUB
Definition: lopcodes.h:244
@ isJ
Definition: lopcodes.h:32
OpCode
Definition: lopcodes.h:196
@ OP_TESTSET
Definition: lopcodes.h:283
@ OP_LOADKX
Definition: lopcodes.h:204
@ OP_SETFIELD
Definition: lopcodes.h:220
#define getOpMode(m)
Definition: lopcodes.h:370
#define testAMode(m)
Definition: lopcodes.h:371
#define LUAI_DDEC(dec)
Definition: luaconf.h:310
@ OP_TEST
Definition: lopcodes.h:282
#define opmode(mm, ot, it, t, a, m)
Definition: lopcodes.h:385
#define NUM_OPCODES
Definition: lopcodes.h:312
LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES]
Definition: lopcodes.c:18
@ OP_MMBINK
Definition: lopcodes.h:259
@ OP_MMBIN
Definition: lopcodes.h:257
@ OP_JMP
Definition: lopcodes.h:270
@ OP_ADDK
Definition: lopcodes.h:228
@ iAx
Definition: lopcodes.h:32
@ OP_POWK
Definition: lopcodes.h:232
@ OP_GETTABLE
Definition: lopcodes.h:213
@ OP_GETTABUP
Definition: lopcodes.h:212
@ OP_POW
Definition: lopcodes.h:247
@ OP_TFORCALL
Definition: lopcodes.h:297
@ OP_EQ
Definition: lopcodes.h:271
@ OP_LFALSESKIP
Definition: lopcodes.h:206
@ OP_BAND
Definition: lopcodes.h:251
@ iAsBx
Definition: lopcodes.h:32
@ OP_FORPREP
Definition: lopcodes.h:293
@ OP_LT
Definition: lopcodes.h:272
@ OP_NEWTABLE
Definition: lopcodes.h:222
@ OP_RETURN1
Definition: lopcodes.h:290
@ OP_SETUPVAL
Definition: lopcodes.h:210
@ OP_LOADNIL
Definition: lopcodes.h:208
@ OP_LEI
Definition: lopcodes.h:278
@ OP_SHL
Definition: lopcodes.h:254
@ OP_MULK
Definition: lopcodes.h:230
@ OP_SETTABUP
Definition: lopcodes.h:217
@ OP_RETURN
Definition: lopcodes.h:288
@ OP_GTI
Definition: lopcodes.h:279