Browse Source

opcode "CLOSURE" gets the prototipe (instead of a previous pushconstant)

v5-2
Roberto Ierusalimschy 27 years ago
parent
commit
2a2b64d6ac
  1. 7
      lopcodes.h
  2. 6
      lua.stx
  3. 13
      lvm.c

7
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) */

6
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);
}
}

13
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;

Loading…
Cancel
Save