diff options
Diffstat (limited to '')
| -rw-r--r-- | ldebug.c | 3 | ||||
| -rw-r--r-- | lparser.c | 14 | ||||
| -rw-r--r-- | lvm.c | 6 |
3 files changed, 12 insertions, 11 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldebug.c,v 1.87 2001/07/03 17:01:34 roberto Exp $ | 2 | ** $Id: ldebug.c,v 1.88 2001/09/07 17:39:10 roberto Exp $ |
| 3 | ** Debug Interface | 3 | ** Debug Interface |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -331,7 +331,6 @@ static int checkopenop (const Proto *pt, int pc) { | |||
| 331 | check(GETARG_B(i) == NO_REG); | 331 | check(GETARG_B(i) == NO_REG); |
| 332 | return 1; | 332 | return 1; |
| 333 | } | 333 | } |
| 334 | case OP_CLOSE: return checkopenop(pt, pc+1); | ||
| 335 | case OP_SETLISTO: return 1; | 334 | case OP_SETLISTO: return 1; |
| 336 | default: return 0; /* invalid instruction after an open call */ | 335 | default: return 0; /* invalid instruction after an open call */ |
| 337 | } | 336 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lparser.c,v 1.156 2001/09/07 17:39:10 roberto Exp $ | 2 | ** $Id: lparser.c,v 1.157 2001/09/25 17:06:48 roberto Exp $ |
| 3 | ** Lua Parser | 3 | ** Lua Parser |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -184,9 +184,10 @@ static void closelevel (LexState *ls, int level) { | |||
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | 186 | ||
| 187 | static void removelocalvars (LexState *ls, int nvars) { | 187 | static void removelocalvars (LexState *ls, int nvars, int toclose) { |
| 188 | FuncState *fs = ls->fs; | 188 | FuncState *fs = ls->fs; |
| 189 | closelevel(ls, fs->nactloc - nvars); | 189 | if (toclose) |
| 190 | closelevel(ls, fs->nactloc - nvars); | ||
| 190 | while (nvars--) | 191 | while (nvars--) |
| 191 | fs->f->locvars[fs->actloc[--fs->nactloc]].endpc = fs->pc; | 192 | fs->f->locvars[fs->actloc[--fs->nactloc]].endpc = fs->pc; |
| 192 | } | 193 | } |
| @@ -333,7 +334,7 @@ static void close_func (LexState *ls) { | |||
| 333 | lua_State *L = ls->L; | 334 | lua_State *L = ls->L; |
| 334 | FuncState *fs = ls->fs; | 335 | FuncState *fs = ls->fs; |
| 335 | Proto *f = fs->f; | 336 | Proto *f = fs->f; |
| 336 | removelocalvars(ls, fs->nactloc); | 337 | removelocalvars(ls, fs->nactloc, 0); |
| 337 | luaK_codeABC(fs, OP_RETURN, 0, 0, 0); /* final return */ | 338 | luaK_codeABC(fs, OP_RETURN, 0, 0, 0); /* final return */ |
| 338 | luaK_getlabel(fs); /* close eventual list of pending jumps */ | 339 | luaK_getlabel(fs); /* close eventual list of pending jumps */ |
| 339 | lua_assert(G(L)->roottable == fs->h); | 340 | lua_assert(G(L)->roottable == fs->h); |
| @@ -816,7 +817,7 @@ static void block (LexState *ls) { | |||
| 816 | FuncState *fs = ls->fs; | 817 | FuncState *fs = ls->fs; |
| 817 | int nactloc = fs->nactloc; | 818 | int nactloc = fs->nactloc; |
| 818 | chunk(ls); | 819 | chunk(ls); |
| 819 | removelocalvars(ls, fs->nactloc - nactloc); | 820 | removelocalvars(ls, fs->nactloc - nactloc, 1); |
| 820 | fs->freereg = nactloc; /* free registers used by locals */ | 821 | fs->freereg = nactloc; /* free registers used by locals */ |
| 821 | } | 822 | } |
| 822 | 823 | ||
| @@ -951,7 +952,7 @@ static void forbody (LexState *ls, int nvar, OpCode prepfor, OpCode loopfor) { | |||
| 951 | block(ls); | 952 | block(ls); |
| 952 | luaK_patchlist(fs, luaK_codeAsBc(fs, loopfor, basereg, NO_JUMP), blockinit); | 953 | luaK_patchlist(fs, luaK_codeAsBc(fs, loopfor, basereg, NO_JUMP), blockinit); |
| 953 | luaK_fixfor(fs, prep, luaK_getlabel(fs)); | 954 | luaK_fixfor(fs, prep, luaK_getlabel(fs)); |
| 954 | removelocalvars(ls, nvar); | 955 | removelocalvars(ls, nvar, 1); |
| 955 | } | 956 | } |
| 956 | 957 | ||
| 957 | 958 | ||
| @@ -1128,7 +1129,6 @@ static void retstat (LexState *ls) { | |||
| 1128 | nret = fs->freereg - first; /* return all `active' values */ | 1129 | nret = fs->freereg - first; /* return all `active' values */ |
| 1129 | } | 1130 | } |
| 1130 | } | 1131 | } |
| 1131 | closelevel(ls, 0); | ||
| 1132 | luaK_codeABC(fs, OP_RETURN, first, nret, 0); | 1132 | luaK_codeABC(fs, OP_RETURN, first, nret, 0); |
| 1133 | fs->freereg = fs->nactloc; /* removes all temp values */ | 1133 | fs->freereg = fs->nactloc; /* removes all temp values */ |
| 1134 | } | 1134 | } |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lvm.c,v 1.190 2001/06/28 14:57:17 roberto Exp roberto $ | 2 | ** $Id: lvm.c,v 1.193 2001/09/07 17:39:10 roberto Exp $ |
| 3 | ** Lua virtual machine | 3 | ** Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -556,7 +556,9 @@ StkId luaV_execute (lua_State *L, const Closure *cl, StkId base) { | |||
| 556 | break; | 556 | break; |
| 557 | } | 557 | } |
| 558 | case OP_RETURN: { | 558 | case OP_RETURN: { |
| 559 | int b = GETARG_B(i); | 559 | int b; |
| 560 | luaF_close(L, base); | ||
| 561 | b = GETARG_B(i); | ||
| 560 | if (b != NO_REG) | 562 | if (b != NO_REG) |
| 561 | L->top = ra+b; | 563 | L->top = ra+b; |
| 562 | return ra; | 564 | return ra; |
