no more compatibility code for traversing tables

This commit is contained in:
Roberto Ierusalimschy 2005-05-04 17:42:28 -03:00
parent 12acca7bd8
commit 65f4a0f636
5 changed files with 6 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/*
** $Id: ldebug.c,v 2.14 2005/04/05 13:41:29 roberto Exp roberto $
** $Id: ldebug.c,v 2.15 2005/04/14 13:30:47 roberto Exp roberto $
** Debug Interface
** See Copyright Notice in lua.h
*/
@ -368,7 +368,6 @@ static Instruction symbexec (const Proto *pt, int lastpc, int reg) {
if (reg >= a+3) last = pc; /* affect all regs above its call base */
break;
}
case OP_TFORPREP:
case OP_FORLOOP:
case OP_FORPREP:
checkreg(pt, a+3);

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.c,v 1.31 2005/03/08 18:00:16 roberto Exp roberto $
** $Id: lopcodes.c,v 1.32 2005/03/16 16:59:21 roberto Exp roberto $
** See Copyright Notice in lua.h
*/
@ -49,7 +49,6 @@ const char *const luaP_opnames[NUM_OPCODES+1] = {
"FORLOOP",
"FORPREP",
"TFORLOOP",
"TFORPREP",
"SETLIST",
"CLOSE",
"CLOSURE",
@ -95,7 +94,6 @@ const lu_byte luaP_opmodes[NUM_OPCODES] = {
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */
,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */
,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TFORLOOP */
,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_TFORPREP */
,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */
,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */
,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */

View File

@ -1,5 +1,5 @@
/*
** $Id: lopcodes.h,v 1.117 2005/03/09 16:28:07 roberto Exp roberto $
** $Id: lopcodes.h,v 1.118 2005/03/16 16:59:21 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -197,8 +197,6 @@ OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */
OP_TFORLOOP,/* A C R(A+2), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2));
if R(A+2) ~= nil then pc++ */
OP_TFORPREP,/* A sBx if type(R(A)) == table then R(A+1):=R(A), R(A):=next;
pc+=sBx */
OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */

View File

@ -1,5 +1,5 @@
/*
** $Id: lparser.c,v 2.22 2005/04/29 12:43:47 roberto Exp roberto $
** $Id: lparser.c,v 2.23 2005/05/04 16:36:23 roberto Exp roberto $
** Lua Parser
** See Copyright Notice in lua.h
*/
@ -1070,7 +1070,7 @@ static void forbody (LexState *ls, int base, int line, int nvars, int isnum) {
int prep, endfor;
adjustlocalvars(ls, 3); /* control variables */
checknext(ls, TK_DO);
prep = luaK_codeAsBx(fs, (isnum ? OP_FORPREP : OP_TFORPREP), base, NO_JUMP);
prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs);
enterblock(fs, &bl, 0); /* scope for declared variables */
adjustlocalvars(ls, nvars);
luaK_reserveregs(fs, nvars);

10
lvm.c
View File

@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.40 2005/05/03 19:01:17 roberto Exp roberto $
** $Id: lvm.c,v 2.41 2005/05/03 19:30:17 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@ -714,14 +714,6 @@ StkId luaV_execute (lua_State *L, int nexeccalls) {
}
continue;
}
case OP_TFORPREP: { /* for compatibility only */
if (ttistable(ra)) {
setobjs2s(L, ra+1, ra);
setobj2s(L, ra, luaH_getstr(hvalue(gt(L)), luaS_new(L, "next")));
}
dojump(L, pc, GETARG_sBx(i));
continue;
}
case OP_SETLIST: {
int n = GETARG_B(i);
int c = GETARG_C(i);