details in opcode list

This commit is contained in:
Roberto Ierusalimschy
2010-10-13 13:45:54 -03:00
parent cd0ebd0a80
commit f3026c36c2
2 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lopcodes.c,v 1.42 2010/02/26 20:40:29 roberto Exp roberto $ ** $Id: lopcodes.c,v 1.43 2010/03/12 19:14:06 roberto Exp roberto $
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -48,11 +48,11 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = {
"FORLOOP", "FORLOOP",
"FORPREP", "FORPREP",
"TFORCALL", "TFORCALL",
"TFORLOOP",
"SETLIST", "SETLIST",
"CLOSE", "CLOSE",
"CLOSURE", "CLOSURE",
"VARARG", "VARARG",
"TFORLOOP",
"EXTRAARG", "EXTRAARG",
NULL NULL
}; };
@@ -96,11 +96,11 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */
,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */
,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */
,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */
,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */
}; };

View File

@@ -1,5 +1,5 @@
/* /*
** $Id: lopcodes.h,v 1.134 2010/02/26 20:40:29 roberto Exp roberto $ ** $Id: lopcodes.h,v 1.135 2010/03/12 19:14:06 roberto Exp roberto $
** Opcodes for Lua virtual machine ** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -17,6 +17,7 @@
`A' : 8 bits `A' : 8 bits
`B' : 9 bits `B' : 9 bits
`C' : 9 bits `C' : 9 bits
'Ax' : 26 bits ('A', 'B', and 'C' together)
`Bx' : 18 bits (`B' and `C' together) `Bx' : 18 bits (`B' and `C' together)
`sBx' : signed Bx `sBx' : signed Bx
@@ -212,6 +213,8 @@ OP_FORLOOP,/* A sBx R(A)+=R(A+2);
OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */ OP_TFORCALL,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); */
OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */
OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/ OP_CLOSE,/* A close all variables in the stack up to (>=) R(A)*/
@@ -219,8 +222,6 @@ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */
OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */
OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/
OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */ OP_EXTRAARG/* Ax extra (larger) argument for previous opcode */
} OpCode; } OpCode;