diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -842,6 +842,10 @@ void luaV_finishOp (lua_State *L) { | |||
842 | luaV_concat(L, total); /* concat them (may yield again) */ | 842 | luaV_concat(L, total); /* concat them (may yield again) */ |
843 | break; | 843 | break; |
844 | } | 844 | } |
845 | case OP_CLOSE: case OP_RETURN: { /* yielded closing variables */ | ||
846 | ci->u.l.savedpc--; /* repeat instruction to close other vars. */ | ||
847 | break; | ||
848 | } | ||
845 | default: { | 849 | default: { |
846 | /* only these other opcodes can yield */ | 850 | /* only these other opcodes can yield */ |
847 | lua_assert(op == OP_TFORCALL || op == OP_CALL || | 851 | lua_assert(op == OP_TFORCALL || op == OP_CALL || |
@@ -1524,7 +1528,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1524 | vmbreak; | 1528 | vmbreak; |
1525 | } | 1529 | } |
1526 | vmcase(OP_CLOSE) { | 1530 | vmcase(OP_CLOSE) { |
1527 | Protect(luaF_close(L, ra, LUA_OK)); | 1531 | Protect(luaF_close(L, ra, LUA_OK, 1)); |
1528 | vmbreak; | 1532 | vmbreak; |
1529 | } | 1533 | } |
1530 | vmcase(OP_TBC) { | 1534 | vmcase(OP_TBC) { |
@@ -1632,7 +1636,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1632 | /* close upvalues from current call; the compiler ensures | 1636 | /* close upvalues from current call; the compiler ensures |
1633 | that there are no to-be-closed variables here, so this | 1637 | that there are no to-be-closed variables here, so this |
1634 | call cannot change the stack */ | 1638 | call cannot change the stack */ |
1635 | luaF_close(L, base, NOCLOSINGMETH); | 1639 | luaF_close(L, base, NOCLOSINGMETH, 0); |
1636 | lua_assert(base == ci->func + 1); | 1640 | lua_assert(base == ci->func + 1); |
1637 | } | 1641 | } |
1638 | while (!ttisfunction(s2v(ra))) { /* not a function? */ | 1642 | while (!ttisfunction(s2v(ra))) { /* not a function? */ |
@@ -1662,7 +1666,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1662 | if (TESTARG_k(i)) { /* may there be open upvalues? */ | 1666 | if (TESTARG_k(i)) { /* may there be open upvalues? */ |
1663 | if (L->top < ci->top) | 1667 | if (L->top < ci->top) |
1664 | L->top = ci->top; | 1668 | L->top = ci->top; |
1665 | luaF_close(L, base, CLOSEKTOP); | 1669 | luaF_close(L, base, CLOSEKTOP, 1); |
1666 | updatetrap(ci); | 1670 | updatetrap(ci); |
1667 | updatestack(ci); | 1671 | updatestack(ci); |
1668 | } | 1672 | } |