diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-02-07 10:28:27 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-02-07 10:28:27 -0200 |
commit | f8d677f94c3b4309be94698d33aeb0590a51eabc (patch) | |
tree | 139b3adda71ce4b345005da99acd059a4b883e39 /lparser.c | |
parent | 094a7d0290bbbe248d9d29b28c2567283d5ad0ba (diff) | |
download | lua-f8d677f94c3b4309be94698d33aeb0590a51eabc.tar.gz lua-f8d677f94c3b4309be94698d33aeb0590a51eabc.tar.bz2 lua-f8d677f94c3b4309be94698d33aeb0590a51eabc.zip |
no more 'OP_CLOSE' instructions (use jumps to close upvalues)
Diffstat (limited to 'lparser.c')
-rw-r--r-- | lparser.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lparser.c,v 2.96 2011/02/01 18:03:10 roberto Exp roberto $ | 2 | ** $Id: lparser.c,v 2.97 2011/02/04 17:34:43 roberto Exp roberto $ |
3 | ** Lua Parser | 3 | ** Lua Parser |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -429,8 +429,12 @@ static void leaveblock (FuncState *fs) { | |||
429 | removevars(fs, bl->nactvar); | 429 | removevars(fs, bl->nactvar); |
430 | fs->ls->labell->nlabel = bl->firstlabel; /* remove local labels */ | 430 | fs->ls->labell->nlabel = bl->firstlabel; /* remove local labels */ |
431 | movegotosout(fs, bl); | 431 | movegotosout(fs, bl); |
432 | if (bl->upval) | 432 | if (bl->upval) { |
433 | luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); | 433 | /* create a 'jump to here' to close upvalues */ |
434 | int j = luaK_jump(fs); | ||
435 | luaK_patchclose(fs, j, bl->nactvar); | ||
436 | luaK_patchtohere(fs, j); | ||
437 | } | ||
434 | /* a block either controls scope or breaks (never both) */ | 438 | /* a block either controls scope or breaks (never both) */ |
435 | lua_assert(!bl->isbreakable || !bl->upval); | 439 | lua_assert(!bl->isbreakable || !bl->upval); |
436 | lua_assert(bl->nactvar == fs->nactvar); | 440 | lua_assert(bl->nactvar == fs->nactvar); |