diff --git a/lopcodes.h b/lopcodes.h index 591ff7f4..5ee96ad9 100644 --- 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 index ad7f3c88..fcfd9aa0 100644 --- 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; icurrState+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 index 2b1622d1..c41d84b5 100644 --- 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;