diff options
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1564,16 +1564,15 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1564 | } | 1564 | } |
1565 | vmcase(OP_TAILCALL) { | 1565 | vmcase(OP_TAILCALL) { |
1566 | int b = GETARG_B(i); /* number of arguments + 1 (function) */ | 1566 | int b = GETARG_B(i); /* number of arguments + 1 (function) */ |
1567 | int delta = 0; /* virtual 'func' - real 'func' (vararg functions) */ | 1567 | int nparams1 = GETARG_C(i); |
1568 | /* delat is virtual 'func' - real 'func' (vararg functions) */ | ||
1569 | int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; | ||
1568 | if (b != 0) | 1570 | if (b != 0) |
1569 | L->top = ra + b; | 1571 | L->top = ra + b; |
1570 | else /* previous instruction set top */ | 1572 | else /* previous instruction set top */ |
1571 | b = cast_int(L->top - ra); | 1573 | b = cast_int(L->top - ra); |
1572 | savepc(ci); /* some calls here can raise errors */ | 1574 | savepc(ci); /* some calls here can raise errors */ |
1573 | if (TESTARG_k(i)) { | 1575 | if (TESTARG_k(i)) { |
1574 | int nparams1 = GETARG_C(i); | ||
1575 | if (nparams1) /* vararg function? */ | ||
1576 | delta = ci->u.l.nextraargs + nparams1; | ||
1577 | /* close upvalues from current call; the compiler ensures | 1576 | /* close upvalues from current call; the compiler ensures |
1578 | that there are no to-be-closed variables here */ | 1577 | that there are no to-be-closed variables here */ |
1579 | luaF_close(L, base, NOCLOSINGMETH); | 1578 | luaF_close(L, base, NOCLOSINGMETH); |
@@ -1599,18 +1598,18 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1599 | } | 1598 | } |
1600 | vmcase(OP_RETURN) { | 1599 | vmcase(OP_RETURN) { |
1601 | int n = GETARG_B(i) - 1; /* number of results */ | 1600 | int n = GETARG_B(i) - 1; /* number of results */ |
1601 | int nparams1 = GETARG_C(i); | ||
1602 | if (n < 0) /* not fixed? */ | 1602 | if (n < 0) /* not fixed? */ |
1603 | n = cast_int(L->top - ra); /* get what is available */ | 1603 | n = cast_int(L->top - ra); /* get what is available */ |
1604 | savepc(ci); | 1604 | savepc(ci); |
1605 | if (TESTARG_k(i)) { | 1605 | if (TESTARG_k(i)) { |
1606 | int nparams1 = GETARG_C(i); | ||
1607 | if (L->top < ci->top) | 1606 | if (L->top < ci->top) |
1608 | L->top = ci->top; | 1607 | L->top = ci->top; |
1609 | luaF_close(L, base, LUA_OK); /* there may be open upvalues */ | 1608 | luaF_close(L, base, LUA_OK); /* there may be open upvalues */ |
1610 | updatestack(ci); | 1609 | updatestack(ci); |
1611 | if (nparams1) /* vararg function? */ | ||
1612 | ci->func -= ci->u.l.nextraargs + nparams1; | ||
1613 | } | 1610 | } |
1611 | if (nparams1) /* vararg function? */ | ||
1612 | ci->func -= ci->u.l.nextraargs + nparams1; | ||
1614 | L->top = ra + n; /* set call for 'luaD_poscall' */ | 1613 | L->top = ra + n; /* set call for 'luaD_poscall' */ |
1615 | luaD_poscall(L, ci, n); | 1614 | luaD_poscall(L, ci, n); |
1616 | return; | 1615 | return; |