From f8d677f94c3b4309be94698d33aeb0590a51eabc Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 7 Feb 2011 10:28:27 -0200 Subject: no more 'OP_CLOSE' instructions (use jumps to close upvalues) --- lparser.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lparser.c') 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); -- cgit v1.2.3-55-g6feb