|
native Lua
0.4.0
Lua on the platform you use with the compiler you choose
|
Go to the documentation of this file.
40 #define SIZE_Bx (SIZE_C + SIZE_B)
42 #define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A)
47 #define POS_A (POS_OP + SIZE_OP)
48 #define POS_C (POS_A + SIZE_A)
49 #define POS_B (POS_C + SIZE_C)
59 #if SIZE_Bx < LUAI_BITSINT-1
60 #define MAXARG_Bx ((1<<SIZE_Bx)-1)
61 #define MAXARG_sBx (MAXARG_Bx>>1)
63 #define MAXARG_Bx MAX_INT
64 #define MAXARG_sBx MAX_INT
67 #if SIZE_Ax < LUAI_BITSINT-1
68 #define MAXARG_Ax ((1<<SIZE_Ax)-1)
70 #define MAXARG_Ax MAX_INT
74 #define MAXARG_A ((1<<SIZE_A)-1)
75 #define MAXARG_B ((1<<SIZE_B)-1)
76 #define MAXARG_C ((1<<SIZE_C)-1)
80 #define MASK1(n,p) ((~((~(Instruction)0)<<(n)))<<(p))
83 #define MASK0(n,p) (~MASK1(n,p))
89 #define GET_OPCODE(i) (cast(OpCode, ((i)>>POS_OP) & MASK1(SIZE_OP,0)))
90 #define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \
91 ((cast(Instruction, o)<<POS_OP)&MASK1(SIZE_OP,POS_OP))))
93 #define getarg(i,pos,size) (cast(int, ((i)>>pos) & MASK1(size,0)))
94 #define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \
95 ((cast(Instruction, v)<<pos)&MASK1(size,pos))))
97 #define GETARG_A(i) getarg(i, POS_A, SIZE_A)
98 #define SETARG_A(i,v) setarg(i, v, POS_A, SIZE_A)
100 #define GETARG_B(i) getarg(i, POS_B, SIZE_B)
101 #define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B)
103 #define GETARG_C(i) getarg(i, POS_C, SIZE_C)
104 #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C)
106 #define GETARG_Bx(i) getarg(i, POS_Bx, SIZE_Bx)
107 #define SETARG_Bx(i,v) setarg(i, v, POS_Bx, SIZE_Bx)
109 #define GETARG_Ax(i) getarg(i, POS_Ax, SIZE_Ax)
110 #define SETARG_Ax(i,v) setarg(i, v, POS_Ax, SIZE_Ax)
112 #define GETARG_sBx(i) (GETARG_Bx(i)-MAXARG_sBx)
113 #define SETARG_sBx(i,b) SETARG_Bx((i),cast(unsigned int, (b)+MAXARG_sBx))
116 #define CREATE_ABC(o,a,b,c) ((cast(Instruction, o)<<POS_OP) \
117 | (cast(Instruction, a)<<POS_A) \
118 | (cast(Instruction, b)<<POS_B) \
119 | (cast(Instruction, c)<<POS_C))
121 #define CREATE_ABx(o,a,bc) ((cast(Instruction, o)<<POS_OP) \
122 | (cast(Instruction, a)<<POS_A) \
123 | (cast(Instruction, bc)<<POS_Bx))
125 #define CREATE_Ax(o,a) ((cast(Instruction, o)<<POS_OP) \
126 | (cast(Instruction, a)<<POS_Ax))
134 #define BITRK (1 << (SIZE_B - 1))
137 #define ISK(x) ((x) & BITRK)
140 #define INDEXK(r) ((int)(r) & ~BITRK)
142 #if !defined(MAXINDEXRK)
143 #define MAXINDEXRK (BITRK - 1)
147 #define RKASK(x) ((x) | BITRK)
153 #define NO_REG MAXARG_A
237 #define NUM_OPCODES (cast(int, OP_EXTRAARG) + 1)
283 #define getOpMode(m) (cast(enum OpMode, luaP_opmodes[m] & 3))
284 #define getBMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 4) & 3))
285 #define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3))
286 #define testAMode(m) (luaP_opmodes[m] & (1 << 6))
287 #define testTMode(m) (luaP_opmodes[m] & (1 << 7))
294 #define LFIELDS_PER_FLUSH 50
@ OP_SETLIST
Definition: lopcodes.h:227
@ OP_VARARG
Definition: lopcodes.h:231
@ OP_SELF
Definition: lopcodes.h:187
@ OP_TAILCALL
Definition: lopcodes.h:217
@ OP_CALL
Definition: lopcodes.h:216
@ OP_SHR
Definition: lopcodes.h:200
LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]
Definition: lopcodes.h:290
@ OP_GETUPVAL
Definition: lopcodes.h:176
@ OpArgN
Definition: lopcodes.h:275
@ OP_FORLOOP
Definition: lopcodes.h:220
@ OP_CONCAT
Definition: lopcodes.h:206
@ OP_BNOT
Definition: lopcodes.h:202
@ iABx
Definition: lopcodes.h:32
@ OP_LE
Definition: lopcodes.h:211
@ OP_UNM
Definition: lopcodes.h:201
@ OP_MOVE
Definition: lopcodes.h:171
@ OpArgR
Definition: lopcodes.h:277
@ OP_DIV
Definition: lopcodes.h:194
#define LUAI_DDEC
Definition: luaconf.h:285
@ OP_NOT
Definition: lopcodes.h:203
@ OP_TFORLOOP
Definition: lopcodes.h:225
@ OP_EXTRAARG
Definition: lopcodes.h:233
@ OP_CLOSURE
Definition: lopcodes.h:229
@ OP_SETTABLE
Definition: lopcodes.h:183
unsigned char lu_byte
Definition: llimits.h:35
@ OP_IDIV
Definition: lopcodes.h:195
@ OP_ADD
Definition: lopcodes.h:189
@ OP_MOD
Definition: lopcodes.h:192
@ OP_BXOR
Definition: lopcodes.h:198
@ OP_LOADK
Definition: lopcodes.h:172
@ OP_MUL
Definition: lopcodes.h:191
@ OpArgK
Definition: lopcodes.h:278
LUAI_DDEC const lu_byte luaP_opmodes[NUM_OPCODES]
Definition: lopcodes.h:281
OpMode
Definition: lopcodes.h:32
@ iABC
Definition: lopcodes.h:32
OpArgMask
Definition: lopcodes.h:274
@ OP_BOR
Definition: lopcodes.h:197
@ OP_LEN
Definition: lopcodes.h:204
@ OP_SUB
Definition: lopcodes.h:190
OpCode
Definition: lopcodes.h:167
@ OP_TESTSET
Definition: lopcodes.h:214
@ OP_LOADKX
Definition: lopcodes.h:173
@ OpArgU
Definition: lopcodes.h:276
@ OP_TEST
Definition: lopcodes.h:213
#define NUM_OPCODES
Definition: lopcodes.h:237
@ OP_LOADBOOL
Definition: lopcodes.h:174
@ OP_JMP
Definition: lopcodes.h:208
@ iAx
Definition: lopcodes.h:32
@ OP_GETTABLE
Definition: lopcodes.h:179
@ OP_GETTABUP
Definition: lopcodes.h:178
@ OP_POW
Definition: lopcodes.h:193
@ OP_TFORCALL
Definition: lopcodes.h:224
@ OP_EQ
Definition: lopcodes.h:209
@ OP_BAND
Definition: lopcodes.h:196
@ iAsBx
Definition: lopcodes.h:32
@ OP_FORPREP
Definition: lopcodes.h:222
@ OP_LT
Definition: lopcodes.h:210
@ OP_NEWTABLE
Definition: lopcodes.h:185
@ OP_SETUPVAL
Definition: lopcodes.h:182
@ OP_LOADNIL
Definition: lopcodes.h:175
@ OP_SHL
Definition: lopcodes.h:199
@ OP_SETTABUP
Definition: lopcodes.h:181
@ OP_RETURN
Definition: lopcodes.h:218