comment explaining OP_VARARG was wrong (and corresponding code was not

very clear)
This commit is contained in:
Roberto Ierusalimschy 2009-10-28 10:20:07 -02:00
parent 5bc91c6405
commit 77077b39d5
2 changed files with 5 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/* /*
** $Id: lopcodes.h,v 1.130 2009/09/23 20:33:05 roberto Exp roberto $ ** $Id: lopcodes.h,v 1.131 2009/09/28 16:32:50 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
*/ */
@ -217,7 +217,7 @@ 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)*/
OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */
OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-1) = 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_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/

6
lvm.c
View File

@ -1,5 +1,5 @@
/* /*
** $Id: lvm.c,v 2.98 2009/09/28 16:32:50 roberto Exp roberto $ ** $Id: lvm.c,v 2.99 2009/09/30 15:38:37 roberto Exp roberto $
** Lua virtual machine ** Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@ -801,10 +801,10 @@ void luaV_execute (lua_State *L) {
int b = GETARG_B(i) - 1; int b = GETARG_B(i) - 1;
int j; int j;
int n = cast_int(base - ci->func) - cl->p->numparams - 1; int n = cast_int(base - ci->func) - cl->p->numparams - 1;
if (b == LUA_MULTRET) { if (b < 0) { /* B == 0? */
b = n; /* get all var. arguments */
Protect(luaD_checkstack(L, n)); Protect(luaD_checkstack(L, n));
ra = RA(i); /* previous call may change the stack */ ra = RA(i); /* previous call may change the stack */
b = n;
L->top = ra + n; L->top = ra + n;
} }
for (j = 0; j < b; j++) { for (j = 0; j < b; j++) {