aboutsummaryrefslogtreecommitdiff
path: root/src/lua/lvm.c
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2021-01-22 17:54:39 +0800
committerLi Jin <dragon-fly@qq.com>2021-01-22 17:54:39 +0800
commit236bcc6e10f59b9336603571f1683cbe4aa411a9 (patch)
tree7116190d16a12bfcb0819e802c6e1d4ac8b0ec70 /src/lua/lvm.c
parentf61b96675547c8bf40c7f646e3766f4139efd927 (diff)
downloadyuescript-236bcc6e10f59b9336603571f1683cbe4aa411a9.tar.gz
yuescript-236bcc6e10f59b9336603571f1683cbe4aa411a9.tar.bz2
yuescript-236bcc6e10f59b9336603571f1683cbe4aa411a9.zip
update included Lua.
Diffstat (limited to 'src/lua/lvm.c')
-rw-r--r--src/lua/lvm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lua/lvm.c b/src/lua/lvm.c
index ccebdbe..d6c05bb 100644
--- a/src/lua/lvm.c
+++ b/src/lua/lvm.c
@@ -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, LUA_OK); 1669 luaF_close(L, base, CLOSEKTOP, 1);
1666 updatetrap(ci); 1670 updatetrap(ci);
1667 updatestack(ci); 1671 updatestack(ci);
1668 } 1672 }