diff options
| -rw-r--r-- | lopcodes.c | 4 | ||||
| -rw-r--r-- | lopcodes.h | 3 | ||||
| -rw-r--r-- | lparser.c | 10 | ||||
| -rw-r--r-- | lvm.c | 5 |
4 files changed, 10 insertions, 12 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.c,v 1.43 2010/03/12 19:14:06 roberto Exp roberto $ | 2 | ** $Id: lopcodes.c,v 1.44 2010/10/13 16:45:54 roberto Exp roberto $ |
| 3 | ** See Copyright Notice in lua.h | 3 | ** See Copyright Notice in lua.h |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| @@ -50,7 +50,6 @@ LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { | |||
| 50 | "TFORCALL", | 50 | "TFORCALL", |
| 51 | "TFORLOOP", | 51 | "TFORLOOP", |
| 52 | "SETLIST", | 52 | "SETLIST", |
| 53 | "CLOSE", | ||
| 54 | "CLOSURE", | 53 | "CLOSURE", |
| 55 | "VARARG", | 54 | "VARARG", |
| 56 | "EXTRAARG", | 55 | "EXTRAARG", |
| @@ -98,7 +97,6 @@ LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { | |||
| 98 | ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ | 97 | ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ |
| 99 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ | 98 | ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ |
| 100 | ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ | 99 | ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ |
| 101 | ,opmode(0, 0, OpArgN, OpArgN, iABC) /* OP_CLOSE */ | ||
| 102 | ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ | 100 | ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ |
| 103 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ | 101 | ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ |
| 104 | ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ | 102 | ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.137 2010/10/25 12:24:55 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.138 2011/02/01 18:03:10 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -216,7 +216,6 @@ OP_TFORLOOP,/* A sBx if R(A+1) ~= nil then { R(A)=R(A+1); pc += sBx }*/ | |||
| 216 | 216 | ||
| 217 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ | 217 | OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ |
| 218 | 218 | ||
| 219 | OP_CLOSE,/* A close all upvalues >= R(A) */ | ||
| 220 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ | 219 | OP_CLOSURE,/* A Bx R(A) := closure(KPROTO[Bx]) */ |
| 221 | 220 | ||
| 222 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ | 221 | OP_VARARG,/* A B R(A), R(A+1), ..., R(A+B-2) = vararg */ |
| @@ -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); |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 2.128 2011/02/01 18:03:10 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 2.129 2011/02/01 18:32:55 roberto Exp roberto $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -793,9 +793,6 @@ void luaV_execute (lua_State *L) { | |||
| 793 | } | 793 | } |
| 794 | L->top = ci->top; /* correct top (in case of previous open call) */ | 794 | L->top = ci->top; /* correct top (in case of previous open call) */ |
| 795 | ) | 795 | ) |
| 796 | vmcase(OP_CLOSE, | ||
| 797 | luaF_close(L, ra); | ||
| 798 | ) | ||
| 799 | vmcase(OP_CLOSURE, | 796 | vmcase(OP_CLOSURE, |
| 800 | Proto *p = cl->p->p[GETARG_Bx(i)]; | 797 | Proto *p = cl->p->p[GETARG_Bx(i)]; |
| 801 | Closure *ncl = getcached(p, cl->upvals, base); /* cached closure */ | 798 | Closure *ncl = getcached(p, cl->upvals, base); /* cached closure */ |
