commit f76bca23ef1f45d3533f16285e223408346ddcaa
parent a5fd7d722c2c15ca954ecd69bfe72b8fe5c4c384
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Tue, 30 Dec 1997 17:08:02 -0200
variants for "ARGS".
Diffstat:
3 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/lopcodes.h b/lopcodes.h
@@ -1,5 +1,5 @@
/*
-** $Id: lopcodes.h,v 1.12 1997/10/24 18:40:29 roberto Exp roberto $
+** $Id: lopcodes.h,v 1.13 1997/12/29 17:35:46 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -172,6 +172,10 @@ POP0,/* - - - TOP-=1 */
POP1,/* - - - TOP-=2 */
ARGS,/* b - - TOP=BASE+b */
+ARGS0,/* - - - TOP=BASE+0 */
+ARGS1,/* - - - TOP=BASE+1 */
+ARGS2,/* - - - TOP=BASE+2 */
+ARGS3,/* - - - TOP=BASE+3 */
VARARGS/* b v_x...v_1 {v_1...v_x;n=x} TOP=BASE+b+1 */
} OpCode;
diff --git a/lua.stx b/lua.stx
@@ -1,6 +1,6 @@
%{
/*
-** $Id: lua.stx,v 1.29 1997/12/29 17:28:45 roberto Exp roberto $
+** $Id: lua.stx,v 1.30 1997/12/29 17:35:46 roberto Exp roberto $
** Syntax analizer and code generator
** See Copyright Notice in lua.h
*/
@@ -450,7 +450,7 @@ static void code_args (int nparams, int dots)
{
L->currState->nlocalvar += nparams;
if (!dots)
- code_oparg(ARGS, 0, L->currState->nlocalvar, L->currState->nlocalvar);
+ code_oparg(ARGS, 4, L->currState->nlocalvar, L->currState->nlocalvar);
else {
code_oparg(VARARGS, 0, L->currState->nlocalvar, L->currState->nlocalvar+1);
add_localvar(luaS_new("arg"));
diff --git a/lvm.c b/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.19 1997/12/23 19:24:19 roberto Exp roberto $
+** $Id: lvm.c,v 1.20 1997/12/29 17:35:46 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -474,7 +474,12 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base)
break;
case ARGS:
- luaD_adjusttop(base+(*pc++));
+ aux = *pc++; goto args;
+
+ case ARGS0: case ARGS1: case ARGS2: case ARGS3:
+ aux -= ARGS0;
+ args:
+ luaD_adjusttop(base+aux);
break;
case VARARGS: