diff --git a/lopcodes.c b/lopcodes.c index 65169e7a..51c85275 100644 --- a/lopcodes.c +++ b/lopcodes.c @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.c,v 1.43 2010/03/12 19:14:06 roberto Exp roberto $ +** $Id: lopcodes.c,v 1.44 2010/10/13 16:45:54 roberto Exp roberto $ ** See Copyright Notice in lua.h */ @@ -50,7 +50,6 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { "TFORCALL", "TFORLOOP", "SETLIST", - "CLOSE", "CLOSURE", "VARARG", "EXTRAARG", @@ -98,7 +97,6 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ - ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ diff --git a/lopcodes.h b/lopcodes.h index f606ab0a..9009b382 100644 --- a/lopcodes.h +++ b/lopcodes.h @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.h,v 1.137 2010/10/25 12:24:55 roberto Exp roberto $ +** $Id: lopcodes.h,v 1.138 2011/02/01 18:03:10 roberto Exp roberto $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -216,7 +216,6 @@ OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ -OP_CLOSE,/* A close all upvalues >= R(A) */ OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ diff --git a/lparser.c b/lparser.c index 52c1bbd0..589f2bb6 100644 --- a/lparser.c +++ b/lparser.c @@ -1,5 +1,5 @@ /* -** $Id: lparser.c,v 2.96 2011/02/01 18:03:10 roberto Exp roberto $ +** $Id: lparser.c,v 2.97 2011/02/04 17:34:43 roberto Exp roberto $ ** Lua Parser ** See Copyright Notice in lua.h */ @@ -429,8 +429,12 @@ static void leaveblock (FuncState *fs) { removevars(fs, bl->nactvar); fs->ls->labell->nlabel = bl->firstlabel; /* remove local labels */ movegotosout(fs, bl); - if (bl->upval) - luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); + if (bl->upval) { + /* create a 'jump to here' to close upvalues */ + int j = luaK_jump(fs); + luaK_patchclose(fs, j, bl->nactvar); + luaK_patchtohere(fs, j); + } /* a block either controls scope or breaks (never both) */ lua_assert(!bl->isbreakable || !bl->upval); lua_assert(bl->nactvar == fs->nactvar); diff --git a/lvm.c b/lvm.c index 9ebddc37..fc36e445 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.128 2011/02/01 18:03:10 roberto Exp roberto $ +** $Id: lvm.c,v 2.129 2011/02/01 18:32:55 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -793,9 +793,6 @@ void luaV_execute (lua_State *L) { } L->top = ci->top; /* correct top (in case of previous open call) */ ) - vmcase(OP_CLOSE, - luaF_close(L, ra); - ) vmcase(OP_CLOSURE, Proto *p = cl->p->p[GETARG_Bx(i)]; Closure *ncl = getcached(p, cl->upvals, base); /* cached closure */