aboutsummaryrefslogtreecommitdiff
path: root/lopcodes.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-07 10:57:57 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-11-07 10:57:57 -0300
commit1499680f9e3d694462ac645ed8162f310509c64c (patch)
tree271fbec82fd9159a819066a0f7f9f6b17ba0cf7e /lopcodes.h
parentbdcfae2e1c860e0726259a6195dbb5d6c2b1e23f (diff)
downloadlua-1499680f9e3d694462ac645ed8162f310509c64c.tar.gz
lua-1499680f9e3d694462ac645ed8162f310509c64c.tar.bz2
lua-1499680f9e3d694462ac645ed8162f310509c64c.zip
Comments in 'lopcodes.h'
Both 'R' and 'K' are arrays, so the comments should use square brackets to index them.
Diffstat (limited to 'lopcodes.h')
-rw-r--r--lopcodes.h184
1 files changed, 92 insertions, 92 deletions
diff --git a/lopcodes.h b/lopcodes.h
index 443a71e9..dbef6a65 100644
--- a/lopcodes.h
+++ b/lopcodes.h
@@ -183,9 +183,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
183 183
184 184
185/* 185/*
186** R(x) - register 186** R[x] - register
187** K(x) - constant (in constant table) 187** K[x] - constant (in constant table)
188** RK(x) == if k(i) then K(x) else R(x) 188** RK(x) == if k(i) then K[x] else R[x]
189*/ 189*/
190 190
191 191
@@ -197,109 +197,109 @@ typedef enum {
197/*---------------------------------------------------------------------- 197/*----------------------------------------------------------------------
198name args description 198name args description
199------------------------------------------------------------------------*/ 199------------------------------------------------------------------------*/
200OP_MOVE,/* A B R(A) := R(B) */ 200OP_MOVE,/* A B R[A] := R[B] */
201OP_LOADI,/* A sBx R(A) := sBx */ 201OP_LOADI,/* A sBx R[A] := sBx */
202OP_LOADF,/* A sBx R(A) := (lua_Number)sBx */ 202OP_LOADF,/* A sBx R[A] := (lua_Number)sBx */
203OP_LOADK,/* A Bx R(A) := K(Bx) */ 203OP_LOADK,/* A Bx R[A] := K[Bx] */
204OP_LOADKX,/* A R(A) := K(extra arg) */ 204OP_LOADKX,/* A R[A] := K[extra arg] */
205OP_LOADBOOL,/* A B C R(A) := (Bool)B; if (C) pc++ */ 205OP_LOADBOOL,/* A B C R[A] := (Bool)B; if (C) pc++ */
206OP_LOADNIL,/* A B R(A), R(A+1), ..., R(A+B) := nil */ 206OP_LOADNIL,/* A B R[A], R[A+1], ..., R[A+B] := nil */
207OP_GETUPVAL,/* A B R(A) := UpValue[B] */ 207OP_GETUPVAL,/* A B R[A] := UpValue[B] */
208OP_SETUPVAL,/* A B UpValue[B] := R(A) */ 208OP_SETUPVAL,/* A B UpValue[B] := R[A] */
209 209
210OP_GETTABUP,/* A B C R(A) := UpValue[B][K(C):string] */ 210OP_GETTABUP,/* A B C R[A] := UpValue[B][K[C]:string] */
211OP_GETTABLE,/* A B C R(A) := R(B)[R(C)] */ 211OP_GETTABLE,/* A B C R[A] := R[B][R[C]] */
212OP_GETI,/* A B C R(A) := R(B)[C] */ 212OP_GETI,/* A B C R[A] := R[B][C] */
213OP_GETFIELD,/* A B C R(A) := R(B)[K(C):string] */ 213OP_GETFIELD,/* A B C R[A] := R[B][K[C]:string] */
214 214
215OP_SETTABUP,/* A B C UpValue[A][K(B):string] := RK(C) */ 215OP_SETTABUP,/* A B C UpValue[A][K[B]:string] := RK(C) */
216OP_SETTABLE,/* A B C R(A)[R(B)] := RK(C) */ 216OP_SETTABLE,/* A B C R[A][R[B]] := RK(C) */
217OP_SETI,/* A B C R(A)[B] := RK(C) */ 217OP_SETI,/* A B C R[A][B] := RK(C) */
218OP_SETFIELD,/* A B C R(A)[K(B):string] := RK(C) */ 218OP_SETFIELD,/* A B C R[A][K[B]:string] := RK(C) */
219 219
220OP_NEWTABLE,/* A B C R(A) := {} */ 220OP_NEWTABLE,/* A B C R[A] := {} */
221 221
222OP_SELF,/* A B C R(A+1) := R(B); R(A) := R(B)[RK(C):string] */ 222OP_SELF,/* A B C R[A+1] := R[B]; R[A] := R[B][RK(C):string] */
223 223
224OP_ADDI,/* A B sC R(A) := R(B) + sC */ 224OP_ADDI,/* A B sC R[A] := R[B] + sC */
225 225
226OP_ADDK,/* A B C R(A) := R(B) + K(C) */ 226OP_ADDK,/* A B C R[A] := R[B] + K[C] */
227OP_SUBK,/* A B C R(A) := R(B) - K(C) */ 227OP_SUBK,/* A B C R[A] := R[B] - K[C] */
228OP_MULK,/* A B C R(A) := R(B) * K(C) */ 228OP_MULK,/* A B C R[A] := R[B] * K[C] */
229OP_MODK,/* A B C R(A) := R(B) % K(C) */ 229OP_MODK,/* A B C R[A] := R[B] % K[C] */
230OP_POWK,/* A B C R(A) := R(B) ^ K(C) */ 230OP_POWK,/* A B C R[A] := R[B] ^ K[C] */
231OP_DIVK,/* A B C R(A) := R(B) / K(C) */ 231OP_DIVK,/* A B C R[A] := R[B] / K[C] */
232OP_IDIVK,/* A B C R(A) := R(B) // K(C) */ 232OP_IDIVK,/* A B C R[A] := R[B] // K[C] */
233 233
234OP_BANDK,/* A B C R(A) := R(B) & K(C):integer */ 234OP_BANDK,/* A B C R[A] := R[B] & K[C]:integer */
235OP_BORK,/* A B C R(A) := R(B) | K(C):integer */ 235OP_BORK,/* A B C R[A] := R[B] | K[C]:integer */
236OP_BXORK,/* A B C R(A) := R(B) ~ K(C):integer */ 236OP_BXORK,/* A B C R[A] := R[B] ~ K[C]:integer */
237 237
238OP_SHRI,/* A B sC R(A) := R(B) >> sC */ 238OP_SHRI,/* A B sC R[A] := R[B] >> sC */
239OP_SHLI,/* A B sC R(A) := sC << R(B) */ 239OP_SHLI,/* A B sC R[A] := sC << R[B] */
240 240
241OP_ADD,/* A B C R(A) := R(B) + R(C) */ 241OP_ADD,/* A B C R[A] := R[B] + R[C] */
242OP_SUB,/* A B C R(A) := R(B) - R(C) */ 242OP_SUB,/* A B C R[A] := R[B] - R[C] */
243OP_MUL,/* A B C R(A) := R(B) * R(C) */ 243OP_MUL,/* A B C R[A] := R[B] * R[C] */
244OP_MOD,/* A B C R(A) := R(B) % R(C) */ 244OP_MOD,/* A B C R[A] := R[B] % R[C] */
245OP_POW,/* A B C R(A) := R(B) ^ R(C) */ 245OP_POW,/* A B C R[A] := R[B] ^ R[C] */
246OP_DIV,/* A B C R(A) := R(B) / R(C) */ 246OP_DIV,/* A B C R[A] := R[B] / R[C] */
247OP_IDIV,/* A B C R(A) := R(B) // R(C) */ 247OP_IDIV,/* A B C R[A] := R[B] // R[C] */
248 248
249OP_BAND,/* A B C R(A) := R(B) & R(C) */ 249OP_BAND,/* A B C R[A] := R[B] & R[C] */
250OP_BOR,/* A B C R(A) := R(B) | R(C) */ 250OP_BOR,/* A B C R[A] := R[B] | R[C] */
251OP_BXOR,/* A B C R(A) := R(B) ~ R(C) */ 251OP_BXOR,/* A B C R[A] := R[B] ~ R[C] */
252OP_SHL,/* A B C R(A) := R(B) << R(C) */ 252OP_SHL,/* A B C R[A] := R[B] << R[C] */
253OP_SHR,/* A B C R(A) := R(B) >> R(C) */ 253OP_SHR,/* A B C R[A] := R[B] >> R[C] */
254 254
255OP_MMBIN,/* A B C call C metamethod over R(A) and R(B) */ 255OP_MMBIN,/* A B C call C metamethod over R[A] and R[B] */
256OP_MMBINI,/* A sB C call C metamethod over R(A) and sB */ 256OP_MMBINI,/* A sB C call C metamethod over R[A] and sB */
257OP_MMBINK,/* A B C call C metamethod over R(A) and K(B) */ 257OP_MMBINK,/* A B C call C metamethod over R[A] and K[B] */
258 258
259OP_UNM,/* A B R(A) := -R(B) */ 259OP_UNM,/* A B R[A] := -R[B] */
260OP_BNOT,/* A B R(A) := ~R(B) */ 260OP_BNOT,/* A B R[A] := ~R[B] */
261OP_NOT,/* A B R(A) := not R(B) */ 261OP_NOT,/* A B R[A] := not R[B] */
262OP_LEN,/* A B R(A) := length of R(B) */ 262OP_LEN,/* A B R[A] := length of R[B] */
263 263
264OP_CONCAT,/* A B R(A) := R(A).. ... ..R(A + B - 1) */ 264OP_CONCAT,/* A B R[A] := R[A].. ... ..R[A + B - 1] */
265 265
266OP_CLOSE,/* A close all upvalues >= R(A) */ 266OP_CLOSE,/* A close all upvalues >= R[A] */
267OP_TBC,/* A mark variable A "to be closed" */ 267OP_TBC,/* A mark variable A "to be closed" */
268OP_JMP,/* k sJ pc += sJ (k is used in code generation) */ 268OP_JMP,/* sJ pc += sJ */
269OP_EQ,/* A B if ((R(A) == R(B)) ~= k) then pc++ */ 269OP_EQ,/* A B if ((R[A] == R[B]) ~= k) then pc++ */
270OP_LT,/* A B if ((R(A) < R(B)) ~= k) then pc++ */ 270OP_LT,/* A B if ((R[A] < R[B]) ~= k) then pc++ */
271OP_LE,/* A B if ((R(A) <= R(B)) ~= k) then pc++ */ 271OP_LE,/* A B if ((R[A] <= R[B]) ~= k) then pc++ */
272 272
273OP_EQK,/* A B if ((R(A) == K(B)) ~= k) then pc++ */ 273OP_EQK,/* A B if ((R[A] == K[B]) ~= k) then pc++ */
274OP_EQI,/* A sB if ((R(A) == sB) ~= k) then pc++ */ 274OP_EQI,/* A sB if ((R[A] == sB) ~= k) then pc++ */
275OP_LTI,/* A sB if ((R(A) < sB) ~= k) then pc++ */ 275OP_LTI,/* A sB if ((R[A] < sB) ~= k) then pc++ */
276OP_LEI,/* A sB if ((R(A) <= sB) ~= k) then pc++ */ 276OP_LEI,/* A sB if ((R[A] <= sB) ~= k) then pc++ */
277OP_GTI,/* A sB if ((R(A) > sB) ~= k) then pc++ */ 277OP_GTI,/* A sB if ((R[A] > sB) ~= k) then pc++ */
278OP_GEI,/* A sB if ((R(A) >= sB) ~= k) then pc++ */ 278OP_GEI,/* A sB if ((R[A] >= sB) ~= k) then pc++ */
279 279
280OP_TEST,/* A if (not R(A) == k) then pc++ */ 280OP_TEST,/* A if (not R[A] == k) then pc++ */
281OP_TESTSET,/* A B if (not R(B) == k) then pc++ else R(A) := R(B) */ 281OP_TESTSET,/* A B if (not R[B] == k) then pc++ else R[A] := R[B] */
282 282
283OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ 283OP_CALL,/* A B C R[A], ... ,R[A+C-2] := R[A](R[A+1], ... ,R[A+B-1]) */
284OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ 284OP_TAILCALL,/* A B C return R[A](R[A+1], ... ,R[A+B-1]) */
285 285
286OP_RETURN,/* A B C return R(A), ... ,R(A+B-2) (see note) */ 286OP_RETURN,/* A B C return R[A], ... ,R[A+B-2] (see note) */
287OP_RETURN0,/* return */ 287OP_RETURN0,/* return */
288OP_RETURN1,/* A return R(A) */ 288OP_RETURN1,/* A return R[A] */
289 289
290OP_FORLOOP,/* A Bx update counters; if loop continues then pc-=Bx; */ 290OP_FORLOOP,/* A Bx update counters; if loop continues then pc-=Bx; */
291OP_FORPREP,/* A Bx <check values and prepare counters>; 291OP_FORPREP,/* A Bx <check values and prepare counters>;
292 if not to run then pc+=Bx+1; */ 292 if not to run then pc+=Bx+1; */
293 293
294OP_TFORPREP,/* A Bx create upvalue for R(A + 3); pc+=Bx */ 294OP_TFORPREP,/* A Bx create upvalue for R[A + 3]; pc+=Bx */
295OP_TFORCALL,/* A C R(A+4), ... ,R(A+3+C) := R(A)(R(A+1), R(A+2)); */ 295OP_TFORCALL,/* A C R[A+4], ... ,R[A+3+C] := R[A](R[A+1], R[A+2]); */
296OP_TFORLOOP,/* A Bx if R(A+2) ~= nil then { R(A)=R(A+2); pc -= Bx } */ 296OP_TFORLOOP,/* A Bx if R[A+2] ~= nil then { R[A]=R[A+2]; pc -= Bx } */
297 297
298OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ 298OP_SETLIST,/* A B C R[A][(C-1)*FPF+i] := R[A+i], 1 <= i <= B */
299 299
300OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ 300OP_CLOSURE,/* A Bx R[A] := closure(KPROTO[Bx]) */
301 301
302OP_VARARG,/* A C R(A), R(A+1), ..., R(A+C-2) = vararg */ 302OP_VARARG,/* A C R[A], R[A+1], ..., R[A+C-2] = vararg */
303 303
304OP_VARARGPREP,/*A (adjust vararg parameters) */ 304OP_VARARGPREP,/*A (adjust vararg parameters) */
305 305