commit 2a2b64d6ac2ea7839dac41cc84be1c7a5a18bee7
parent daa937c043bb0ddb5f4bfe676f8ff13825a99651
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Wed, 25 Mar 1998 15:52:08 -0300
opcode "CLOSURE" gets the prototipe (instead of a previous pushconstant)
Diffstat:
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lopcodes.h b/lopcodes.h
@@ -1,5 +1,5 @@
/*
-** $Id: lopcodes.h,v 1.16 1998/03/10 17:15:05 roberto Exp $
+** $Id: lopcodes.h,v 1.16 1998/03/11 13:59:50 roberto Exp roberto $
** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -154,9 +154,8 @@ IFTUPJMPW,/* w x - (x!=nil)? PC-=w */
IFFUPJMP,/* b x - (x==nil)? PC-=b */
IFFUPJMPW,/* w x - (x==nil)? PC-=w */
-CLOSURE,/* b proto v_b...v_1 c(proto) */
-CLOSURE0,/* - proto c(proto) */
-CLOSURE1,/* - proto v_1 c(proto) */
+CLOSURE,/* b c v_c...v_1 closure(CNST[b], v_c...v_1) */
+CLOSUREW,/* w b v_b...v_1 closure(CNST[w], v_b...v_1) */
CALLFUNC,/* b c v_c...v_1 f r_b...r_1 f(v1,...,v_c) */
CALLFUNC0,/* b v_b...v_1 f - f(v1,...,v_b) */
diff --git a/lua.stx b/lua.stx
@@ -1,6 +1,6 @@
%{
/*
-** $Id: lua.stx,v 1.34 1998/02/11 20:56:46 roberto Exp roberto $
+** $Id: lua.stx,v 1.35 1998/03/09 21:49:52 roberto Exp roberto $
** Syntax analizer and code generator
** See Copyright Notice in lua.h
*/
@@ -554,8 +554,8 @@ static void func_onstack (TProtoFunc *f)
else {
for (i=0; i<nupvalues; i++)
lua_pushvar((L->currState+1)->upvalues[i]);
- code_constant(c);
- code_oparg(CLOSURE, 2, nupvalues, -nupvalues);
+ code_oparg(CLOSURE, 0, c, -nupvalues+1);
+ code_byte(nupvalues);
}
}
diff --git a/lvm.c b/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.25 1998/03/09 21:49:52 roberto Exp roberto $
+** $Id: lvm.c,v 1.26 1998/03/11 13:59:50 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -680,13 +680,14 @@ StkId luaV_execute (Closure *cl, TProtoFunc *tf, StkId base)
if (ttype(--S->top) == LUA_T_NIL) pc -= aux;
break;
- case CLOSURE:
- aux = *pc++; goto closure;
+ case CLOSUREW:
+ aux = next_word(pc); goto closure;
- case CLOSURE0: case CLOSURE1:
- aux -= CLOSURE0;
+ case CLOSURE:
+ aux = *pc++;
closure:
- luaV_closure(aux);
+ *S->top++ = consts[aux];
+ luaV_closure(*pc++);
luaC_checkGC();
break;