diff options
Diffstat (limited to '')
| -rw-r--r-- | src/3rdParty/lua/lvm.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/3rdParty/lua/lvm.c b/src/3rdParty/lua/lvm.c index 73a19ba..2e84dc6 100644 --- a/src/3rdParty/lua/lvm.c +++ b/src/3rdParty/lua/lvm.c | |||
| @@ -608,8 +608,8 @@ int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { | |||
| 608 | if (tm == NULL) /* no TM? */ | 608 | if (tm == NULL) /* no TM? */ |
| 609 | return 0; /* objects are different */ | 609 | return 0; /* objects are different */ |
| 610 | else { | 610 | else { |
| 611 | luaT_callTMres(L, tm, t1, t2, L->top); /* call TM */ | 611 | luaT_callTMres(L, tm, t1, t2, L->top.p); /* call TM */ |
| 612 | return !l_isfalse(s2v(L->top)); | 612 | return !l_isfalse(s2v(L->top.p)); |
| 613 | } | 613 | } |
| 614 | } | 614 | } |
| 615 | 615 | ||
| @@ -633,13 +633,13 @@ static void copy2buff (StkId top, int n, char *buff) { | |||
| 633 | 633 | ||
| 634 | /* | 634 | /* |
| 635 | ** Main operation for concatenation: concat 'total' values in the stack, | 635 | ** Main operation for concatenation: concat 'total' values in the stack, |
| 636 | ** from 'L->top - total' up to 'L->top - 1'. | 636 | ** from 'L->top.p - total' up to 'L->top.p - 1'. |
| 637 | */ | 637 | */ |
| 638 | void luaV_concat (lua_State *L, int total) { | 638 | void luaV_concat (lua_State *L, int total) { |
| 639 | if (total == 1) | 639 | if (total == 1) |
| 640 | return; /* "all" values already concatenated */ | 640 | return; /* "all" values already concatenated */ |
| 641 | do { | 641 | do { |
| 642 | StkId top = L->top; | 642 | StkId top = L->top.p; |
| 643 | int n = 2; /* number of elements handled in this pass (at least 2) */ | 643 | int n = 2; /* number of elements handled in this pass (at least 2) */ |
| 644 | if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) || | 644 | if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) || |
| 645 | !tostring(L, s2v(top - 1))) | 645 | !tostring(L, s2v(top - 1))) |
| @@ -657,7 +657,7 @@ void luaV_concat (lua_State *L, int total) { | |||
| 657 | for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { | 657 | for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { |
| 658 | size_t l = vslen(s2v(top - n - 1)); | 658 | size_t l = vslen(s2v(top - n - 1)); |
| 659 | if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) { | 659 | if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - tl)) { |
| 660 | L->top = top - total; /* pop strings to avoid wasting stack */ | 660 | L->top.p = top - total; /* pop strings to avoid wasting stack */ |
| 661 | luaG_runerror(L, "string length overflow"); | 661 | luaG_runerror(L, "string length overflow"); |
| 662 | } | 662 | } |
| 663 | tl += l; | 663 | tl += l; |
| @@ -674,7 +674,7 @@ void luaV_concat (lua_State *L, int total) { | |||
| 674 | setsvalue2s(L, top - n, ts); /* create result */ | 674 | setsvalue2s(L, top - n, ts); /* create result */ |
| 675 | } | 675 | } |
| 676 | total -= n - 1; /* got 'n' strings to create one new */ | 676 | total -= n - 1; /* got 'n' strings to create one new */ |
| 677 | L->top -= n - 1; /* popped 'n' strings and pushed one */ | 677 | L->top.p -= n - 1; /* popped 'n' strings and pushed one */ |
| 678 | } while (total > 1); /* repeat until only 1 result left */ | 678 | } while (total > 1); /* repeat until only 1 result left */ |
| 679 | } | 679 | } |
| 680 | 680 | ||
| @@ -808,26 +808,26 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | |||
| 808 | */ | 808 | */ |
| 809 | void luaV_finishOp (lua_State *L) { | 809 | void luaV_finishOp (lua_State *L) { |
| 810 | CallInfo *ci = L->ci; | 810 | CallInfo *ci = L->ci; |
| 811 | StkId base = ci->func + 1; | 811 | StkId base = ci->func.p + 1; |
| 812 | Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ | 812 | Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ |
| 813 | OpCode op = GET_OPCODE(inst); | 813 | OpCode op = GET_OPCODE(inst); |
| 814 | switch (op) { /* finish its execution */ | 814 | switch (op) { /* finish its execution */ |
| 815 | case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { | 815 | case OP_MMBIN: case OP_MMBINI: case OP_MMBINK: { |
| 816 | setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top); | 816 | setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top.p); |
| 817 | break; | 817 | break; |
| 818 | } | 818 | } |
| 819 | case OP_UNM: case OP_BNOT: case OP_LEN: | 819 | case OP_UNM: case OP_BNOT: case OP_LEN: |
| 820 | case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: | 820 | case OP_GETTABUP: case OP_GETTABLE: case OP_GETI: |
| 821 | case OP_GETFIELD: case OP_SELF: { | 821 | case OP_GETFIELD: case OP_SELF: { |
| 822 | setobjs2s(L, base + GETARG_A(inst), --L->top); | 822 | setobjs2s(L, base + GETARG_A(inst), --L->top.p); |
| 823 | break; | 823 | break; |
| 824 | } | 824 | } |
| 825 | case OP_LT: case OP_LE: | 825 | case OP_LT: case OP_LE: |
| 826 | case OP_LTI: case OP_LEI: | 826 | case OP_LTI: case OP_LEI: |
| 827 | case OP_GTI: case OP_GEI: | 827 | case OP_GTI: case OP_GEI: |
| 828 | case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */ | 828 | case OP_EQ: { /* note that 'OP_EQI'/'OP_EQK' cannot yield */ |
| 829 | int res = !l_isfalse(s2v(L->top - 1)); | 829 | int res = !l_isfalse(s2v(L->top.p - 1)); |
| 830 | L->top--; | 830 | L->top.p--; |
| 831 | #if defined(LUA_COMPAT_LT_LE) | 831 | #if defined(LUA_COMPAT_LT_LE) |
| 832 | if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ | 832 | if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ |
| 833 | ci->callstatus ^= CIST_LEQ; /* clear mark */ | 833 | ci->callstatus ^= CIST_LEQ; /* clear mark */ |
| @@ -840,11 +840,11 @@ void luaV_finishOp (lua_State *L) { | |||
| 840 | break; | 840 | break; |
| 841 | } | 841 | } |
| 842 | case OP_CONCAT: { | 842 | case OP_CONCAT: { |
| 843 | StkId top = L->top - 1; /* top when 'luaT_tryconcatTM' was called */ | 843 | StkId top = L->top.p - 1; /* top when 'luaT_tryconcatTM' was called */ |
| 844 | int a = GETARG_A(inst); /* first element to concatenate */ | 844 | int a = GETARG_A(inst); /* first element to concatenate */ |
| 845 | int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ | 845 | int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ |
| 846 | setobjs2s(L, top - 2, top); /* put TM result in proper position */ | 846 | setobjs2s(L, top - 2, top); /* put TM result in proper position */ |
| 847 | L->top = top - 1; /* top is one after last element (at top-2) */ | 847 | L->top.p = top - 1; /* top is one after last element (at top-2) */ |
| 848 | luaV_concat(L, total); /* concat them (may yield again) */ | 848 | luaV_concat(L, total); /* concat them (may yield again) */ |
| 849 | break; | 849 | break; |
| 850 | } | 850 | } |
| @@ -856,7 +856,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 856 | StkId ra = base + GETARG_A(inst); | 856 | StkId ra = base + GETARG_A(inst); |
| 857 | /* adjust top to signal correct number of returns, in case the | 857 | /* adjust top to signal correct number of returns, in case the |
| 858 | return is "up to top" ('isIT') */ | 858 | return is "up to top" ('isIT') */ |
| 859 | L->top = ra + ci->u2.nres; | 859 | L->top.p = ra + ci->u2.nres; |
| 860 | /* repeat instruction to close other vars. and complete the return */ | 860 | /* repeat instruction to close other vars. and complete the return */ |
| 861 | ci->u.l.savedpc--; | 861 | ci->u.l.savedpc--; |
| 862 | break; | 862 | break; |
| @@ -1069,7 +1069,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 1069 | 1069 | ||
| 1070 | #define updatetrap(ci) (trap = ci->u.l.trap) | 1070 | #define updatetrap(ci) (trap = ci->u.l.trap) |
| 1071 | 1071 | ||
| 1072 | #define updatebase(ci) (base = ci->func + 1) | 1072 | #define updatebase(ci) (base = ci->func.p + 1) |
| 1073 | 1073 | ||
| 1074 | 1074 | ||
| 1075 | #define updatestack(ci) \ | 1075 | #define updatestack(ci) \ |
| @@ -1104,7 +1104,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 1104 | ** Whenever code can raise errors, the global 'pc' and the global | 1104 | ** Whenever code can raise errors, the global 'pc' and the global |
| 1105 | ** 'top' must be correct to report occasional errors. | 1105 | ** 'top' must be correct to report occasional errors. |
| 1106 | */ | 1106 | */ |
| 1107 | #define savestate(L,ci) (savepc(L), L->top = ci->top) | 1107 | #define savestate(L,ci) (savepc(L), L->top.p = ci->top.p) |
| 1108 | 1108 | ||
| 1109 | 1109 | ||
| 1110 | /* | 1110 | /* |
| @@ -1124,7 +1124,7 @@ void luaV_finishOp (lua_State *L) { | |||
| 1124 | 1124 | ||
| 1125 | /* 'c' is the limit of live values in the stack */ | 1125 | /* 'c' is the limit of live values in the stack */ |
| 1126 | #define checkGC(L,c) \ | 1126 | #define checkGC(L,c) \ |
| 1127 | { luaC_condGC(L, (savepc(L), L->top = (c)), \ | 1127 | { luaC_condGC(L, (savepc(L), L->top.p = (c)), \ |
| 1128 | updatetrap(ci)); \ | 1128 | updatetrap(ci)); \ |
| 1129 | luai_threadyield(L); } | 1129 | luai_threadyield(L); } |
| 1130 | 1130 | ||
| @@ -1155,7 +1155,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1155 | startfunc: | 1155 | startfunc: |
| 1156 | trap = L->hookmask; | 1156 | trap = L->hookmask; |
| 1157 | returning: /* trap already set */ | 1157 | returning: /* trap already set */ |
| 1158 | cl = clLvalue(s2v(ci->func)); | 1158 | cl = clLvalue(s2v(ci->func.p)); |
| 1159 | k = cl->p->k; | 1159 | k = cl->p->k; |
| 1160 | pc = ci->u.l.savedpc; | 1160 | pc = ci->u.l.savedpc; |
| 1161 | if (l_unlikely(trap)) { | 1161 | if (l_unlikely(trap)) { |
| @@ -1167,7 +1167,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1167 | } | 1167 | } |
| 1168 | ci->u.l.trap = 1; /* assume trap is on, for now */ | 1168 | ci->u.l.trap = 1; /* assume trap is on, for now */ |
| 1169 | } | 1169 | } |
| 1170 | base = ci->func + 1; | 1170 | base = ci->func.p + 1; |
| 1171 | /* main loop of interpreter */ | 1171 | /* main loop of interpreter */ |
| 1172 | for (;;) { | 1172 | for (;;) { |
| 1173 | Instruction i; /* instruction being executed */ | 1173 | Instruction i; /* instruction being executed */ |
| @@ -1176,10 +1176,10 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1176 | /* low-level line tracing for debugging Lua */ | 1176 | /* low-level line tracing for debugging Lua */ |
| 1177 | printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); | 1177 | printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); |
| 1178 | #endif | 1178 | #endif |
| 1179 | lua_assert(base == ci->func + 1); | 1179 | lua_assert(base == ci->func.p + 1); |
| 1180 | lua_assert(base <= L->top && L->top <= L->stack_last); | 1180 | lua_assert(base <= L->top.p && L->top.p <= L->stack_last.p); |
| 1181 | /* invalidate top for instructions not expecting it */ | 1181 | /* invalidate top for instructions not expecting it */ |
| 1182 | lua_assert(isIT(i) || (cast_void(L->top = base), 1)); | 1182 | lua_assert(isIT(i) || (cast_void(L->top.p = base), 1)); |
| 1183 | vmdispatch (GET_OPCODE(i)) { | 1183 | vmdispatch (GET_OPCODE(i)) { |
| 1184 | vmcase(OP_MOVE) { | 1184 | vmcase(OP_MOVE) { |
| 1185 | StkId ra = RA(i); | 1185 | StkId ra = RA(i); |
| @@ -1238,20 +1238,20 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1238 | vmcase(OP_GETUPVAL) { | 1238 | vmcase(OP_GETUPVAL) { |
| 1239 | StkId ra = RA(i); | 1239 | StkId ra = RA(i); |
| 1240 | int b = GETARG_B(i); | 1240 | int b = GETARG_B(i); |
| 1241 | setobj2s(L, ra, cl->upvals[b]->v); | 1241 | setobj2s(L, ra, cl->upvals[b]->v.p); |
| 1242 | vmbreak; | 1242 | vmbreak; |
| 1243 | } | 1243 | } |
| 1244 | vmcase(OP_SETUPVAL) { | 1244 | vmcase(OP_SETUPVAL) { |
| 1245 | StkId ra = RA(i); | 1245 | StkId ra = RA(i); |
| 1246 | UpVal *uv = cl->upvals[GETARG_B(i)]; | 1246 | UpVal *uv = cl->upvals[GETARG_B(i)]; |
| 1247 | setobj(L, uv->v, s2v(ra)); | 1247 | setobj(L, uv->v.p, s2v(ra)); |
| 1248 | luaC_barrier(L, uv, s2v(ra)); | 1248 | luaC_barrier(L, uv, s2v(ra)); |
| 1249 | vmbreak; | 1249 | vmbreak; |
| 1250 | } | 1250 | } |
| 1251 | vmcase(OP_GETTABUP) { | 1251 | vmcase(OP_GETTABUP) { |
| 1252 | StkId ra = RA(i); | 1252 | StkId ra = RA(i); |
| 1253 | const TValue *slot; | 1253 | const TValue *slot; |
| 1254 | TValue *upval = cl->upvals[GETARG_B(i)]->v; | 1254 | TValue *upval = cl->upvals[GETARG_B(i)]->v.p; |
| 1255 | TValue *rc = KC(i); | 1255 | TValue *rc = KC(i); |
| 1256 | TString *key = tsvalue(rc); /* key must be a string */ | 1256 | TString *key = tsvalue(rc); /* key must be a string */ |
| 1257 | if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { | 1257 | if (luaV_fastget(L, upval, key, slot, luaH_getshortstr)) { |
| @@ -1306,7 +1306,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1306 | } | 1306 | } |
| 1307 | vmcase(OP_SETTABUP) { | 1307 | vmcase(OP_SETTABUP) { |
| 1308 | const TValue *slot; | 1308 | const TValue *slot; |
| 1309 | TValue *upval = cl->upvals[GETARG_A(i)]->v; | 1309 | TValue *upval = cl->upvals[GETARG_A(i)]->v.p; |
| 1310 | TValue *rb = KB(i); | 1310 | TValue *rb = KB(i); |
| 1311 | TValue *rc = RKC(i); | 1311 | TValue *rc = RKC(i); |
| 1312 | TString *key = tsvalue(rb); /* key must be a string */ | 1312 | TString *key = tsvalue(rb); /* key must be a string */ |
| @@ -1371,7 +1371,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1371 | if (TESTARG_k(i)) /* non-zero extra argument? */ | 1371 | if (TESTARG_k(i)) /* non-zero extra argument? */ |
| 1372 | c += GETARG_Ax(*pc) * (MAXARG_C + 1); /* add it to size */ | 1372 | c += GETARG_Ax(*pc) * (MAXARG_C + 1); /* add it to size */ |
| 1373 | pc++; /* skip extra argument */ | 1373 | pc++; /* skip extra argument */ |
| 1374 | L->top = ra + 1; /* correct top in case of emergency GC */ | 1374 | L->top.p = ra + 1; /* correct top in case of emergency GC */ |
| 1375 | t = luaH_new(L); /* memory allocation */ | 1375 | t = luaH_new(L); /* memory allocation */ |
| 1376 | sethvalue2s(L, ra, t); | 1376 | sethvalue2s(L, ra, t); |
| 1377 | if (b != 0 || c != 0) | 1377 | if (b != 0 || c != 0) |
| @@ -1578,9 +1578,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1578 | vmcase(OP_CONCAT) { | 1578 | vmcase(OP_CONCAT) { |
| 1579 | StkId ra = RA(i); | 1579 | StkId ra = RA(i); |
| 1580 | int n = GETARG_B(i); /* number of elements to concatenate */ | 1580 | int n = GETARG_B(i); /* number of elements to concatenate */ |
| 1581 | L->top = ra + n; /* mark the end of concat operands */ | 1581 | L->top.p = ra + n; /* mark the end of concat operands */ |
| 1582 | ProtectNT(luaV_concat(L, n)); | 1582 | ProtectNT(luaV_concat(L, n)); |
| 1583 | checkGC(L, L->top); /* 'luaV_concat' ensures correct top */ | 1583 | checkGC(L, L->top.p); /* 'luaV_concat' ensures correct top */ |
| 1584 | vmbreak; | 1584 | vmbreak; |
| 1585 | } | 1585 | } |
| 1586 | vmcase(OP_CLOSE) { | 1586 | vmcase(OP_CLOSE) { |
| @@ -1674,7 +1674,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1674 | int b = GETARG_B(i); | 1674 | int b = GETARG_B(i); |
| 1675 | int nresults = GETARG_C(i) - 1; | 1675 | int nresults = GETARG_C(i) - 1; |
| 1676 | if (b != 0) /* fixed number of arguments? */ | 1676 | if (b != 0) /* fixed number of arguments? */ |
| 1677 | L->top = ra + b; /* top signals number of arguments */ | 1677 | L->top.p = ra + b; /* top signals number of arguments */ |
| 1678 | /* else previous instruction set top */ | 1678 | /* else previous instruction set top */ |
| 1679 | savepc(L); /* in case of errors */ | 1679 | savepc(L); /* in case of errors */ |
| 1680 | if ((newci = luaD_precall(L, ra, nresults)) == NULL) | 1680 | if ((newci = luaD_precall(L, ra, nresults)) == NULL) |
| @@ -1693,19 +1693,19 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1693 | /* delta is virtual 'func' - real 'func' (vararg functions) */ | 1693 | /* delta is virtual 'func' - real 'func' (vararg functions) */ |
| 1694 | int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; | 1694 | int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; |
| 1695 | if (b != 0) | 1695 | if (b != 0) |
| 1696 | L->top = ra + b; | 1696 | L->top.p = ra + b; |
| 1697 | else /* previous instruction set top */ | 1697 | else /* previous instruction set top */ |
| 1698 | b = cast_int(L->top - ra); | 1698 | b = cast_int(L->top.p - ra); |
| 1699 | savepc(ci); /* several calls here can raise errors */ | 1699 | savepc(ci); /* several calls here can raise errors */ |
| 1700 | if (TESTARG_k(i)) { | 1700 | if (TESTARG_k(i)) { |
| 1701 | luaF_closeupval(L, base); /* close upvalues from current call */ | 1701 | luaF_closeupval(L, base); /* close upvalues from current call */ |
| 1702 | lua_assert(L->tbclist < base); /* no pending tbc variables */ | 1702 | lua_assert(L->tbclist.p < base); /* no pending tbc variables */ |
| 1703 | lua_assert(base == ci->func + 1); | 1703 | lua_assert(base == ci->func.p + 1); |
| 1704 | } | 1704 | } |
| 1705 | if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0) /* Lua function? */ | 1705 | if ((n = luaD_pretailcall(L, ci, ra, b, delta)) < 0) /* Lua function? */ |
| 1706 | goto startfunc; /* execute the callee */ | 1706 | goto startfunc; /* execute the callee */ |
| 1707 | else { /* C function? */ | 1707 | else { /* C function? */ |
| 1708 | ci->func -= delta; /* restore 'func' (if vararg) */ | 1708 | ci->func.p -= delta; /* restore 'func' (if vararg) */ |
| 1709 | luaD_poscall(L, ci, n); /* finish caller */ | 1709 | luaD_poscall(L, ci, n); /* finish caller */ |
| 1710 | updatetrap(ci); /* 'luaD_poscall' can change hooks */ | 1710 | updatetrap(ci); /* 'luaD_poscall' can change hooks */ |
| 1711 | goto ret; /* caller returns after the tail call */ | 1711 | goto ret; /* caller returns after the tail call */ |
| @@ -1716,19 +1716,19 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1716 | int n = GETARG_B(i) - 1; /* number of results */ | 1716 | int n = GETARG_B(i) - 1; /* number of results */ |
| 1717 | int nparams1 = GETARG_C(i); | 1717 | int nparams1 = GETARG_C(i); |
| 1718 | if (n < 0) /* not fixed? */ | 1718 | if (n < 0) /* not fixed? */ |
| 1719 | n = cast_int(L->top - ra); /* get what is available */ | 1719 | n = cast_int(L->top.p - ra); /* get what is available */ |
| 1720 | savepc(ci); | 1720 | savepc(ci); |
| 1721 | if (TESTARG_k(i)) { /* may there be open upvalues? */ | 1721 | if (TESTARG_k(i)) { /* may there be open upvalues? */ |
| 1722 | ci->u2.nres = n; /* save number of returns */ | 1722 | ci->u2.nres = n; /* save number of returns */ |
| 1723 | if (L->top < ci->top) | 1723 | if (L->top.p < ci->top.p) |
| 1724 | L->top = ci->top; | 1724 | L->top.p = ci->top.p; |
| 1725 | luaF_close(L, base, CLOSEKTOP, 1); | 1725 | luaF_close(L, base, CLOSEKTOP, 1); |
| 1726 | updatetrap(ci); | 1726 | updatetrap(ci); |
| 1727 | updatestack(ci); | 1727 | updatestack(ci); |
| 1728 | } | 1728 | } |
| 1729 | if (nparams1) /* vararg function? */ | 1729 | if (nparams1) /* vararg function? */ |
| 1730 | ci->func -= ci->u.l.nextraargs + nparams1; | 1730 | ci->func.p -= ci->u.l.nextraargs + nparams1; |
| 1731 | L->top = ra + n; /* set call for 'luaD_poscall' */ | 1731 | L->top.p = ra + n; /* set call for 'luaD_poscall' */ |
| 1732 | luaD_poscall(L, ci, n); | 1732 | luaD_poscall(L, ci, n); |
| 1733 | updatetrap(ci); /* 'luaD_poscall' can change hooks */ | 1733 | updatetrap(ci); /* 'luaD_poscall' can change hooks */ |
| 1734 | goto ret; | 1734 | goto ret; |
| @@ -1736,7 +1736,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1736 | vmcase(OP_RETURN0) { | 1736 | vmcase(OP_RETURN0) { |
| 1737 | if (l_unlikely(L->hookmask)) { | 1737 | if (l_unlikely(L->hookmask)) { |
| 1738 | StkId ra = RA(i); | 1738 | StkId ra = RA(i); |
| 1739 | L->top = ra; | 1739 | L->top.p = ra; |
| 1740 | savepc(ci); | 1740 | savepc(ci); |
| 1741 | luaD_poscall(L, ci, 0); /* no hurry... */ | 1741 | luaD_poscall(L, ci, 0); /* no hurry... */ |
| 1742 | trap = 1; | 1742 | trap = 1; |
| @@ -1744,16 +1744,16 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1744 | else { /* do the 'poscall' here */ | 1744 | else { /* do the 'poscall' here */ |
| 1745 | int nres; | 1745 | int nres; |
| 1746 | L->ci = ci->previous; /* back to caller */ | 1746 | L->ci = ci->previous; /* back to caller */ |
| 1747 | L->top = base - 1; | 1747 | L->top.p = base - 1; |
| 1748 | for (nres = ci->nresults; l_unlikely(nres > 0); nres--) | 1748 | for (nres = ci->nresults; l_unlikely(nres > 0); nres--) |
| 1749 | setnilvalue(s2v(L->top++)); /* all results are nil */ | 1749 | setnilvalue(s2v(L->top.p++)); /* all results are nil */ |
| 1750 | } | 1750 | } |
| 1751 | goto ret; | 1751 | goto ret; |
| 1752 | } | 1752 | } |
| 1753 | vmcase(OP_RETURN1) { | 1753 | vmcase(OP_RETURN1) { |
| 1754 | if (l_unlikely(L->hookmask)) { | 1754 | if (l_unlikely(L->hookmask)) { |
| 1755 | StkId ra = RA(i); | 1755 | StkId ra = RA(i); |
| 1756 | L->top = ra + 1; | 1756 | L->top.p = ra + 1; |
| 1757 | savepc(ci); | 1757 | savepc(ci); |
| 1758 | luaD_poscall(L, ci, 1); /* no hurry... */ | 1758 | luaD_poscall(L, ci, 1); /* no hurry... */ |
| 1759 | trap = 1; | 1759 | trap = 1; |
| @@ -1762,13 +1762,13 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1762 | int nres = ci->nresults; | 1762 | int nres = ci->nresults; |
| 1763 | L->ci = ci->previous; /* back to caller */ | 1763 | L->ci = ci->previous; /* back to caller */ |
| 1764 | if (nres == 0) | 1764 | if (nres == 0) |
| 1765 | L->top = base - 1; /* asked for no results */ | 1765 | L->top.p = base - 1; /* asked for no results */ |
| 1766 | else { | 1766 | else { |
| 1767 | StkId ra = RA(i); | 1767 | StkId ra = RA(i); |
| 1768 | setobjs2s(L, base - 1, ra); /* at least this result */ | 1768 | setobjs2s(L, base - 1, ra); /* at least this result */ |
| 1769 | L->top = base; | 1769 | L->top.p = base; |
| 1770 | for (; l_unlikely(nres > 1); nres--) | 1770 | for (; l_unlikely(nres > 1); nres--) |
| 1771 | setnilvalue(s2v(L->top++)); /* complete missing results */ | 1771 | setnilvalue(s2v(L->top.p++)); /* complete missing results */ |
| 1772 | } | 1772 | } |
| 1773 | } | 1773 | } |
| 1774 | ret: /* return from a Lua function */ | 1774 | ret: /* return from a Lua function */ |
| @@ -1824,7 +1824,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1824 | */ | 1824 | */ |
| 1825 | /* push function, state, and control variable */ | 1825 | /* push function, state, and control variable */ |
| 1826 | memcpy(ra + 4, ra, 3 * sizeof(*ra)); | 1826 | memcpy(ra + 4, ra, 3 * sizeof(*ra)); |
| 1827 | L->top = ra + 4 + 3; | 1827 | L->top.p = ra + 4 + 3; |
| 1828 | ProtectNT(luaD_call(L, ra + 4, GETARG_C(i))); /* do the call */ | 1828 | ProtectNT(luaD_call(L, ra + 4, GETARG_C(i))); /* do the call */ |
| 1829 | updatestack(ci); /* stack may have changed */ | 1829 | updatestack(ci); /* stack may have changed */ |
| 1830 | i = *(pc++); /* go to next instruction */ | 1830 | i = *(pc++); /* go to next instruction */ |
| @@ -1846,9 +1846,9 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
| 1846 | unsigned int last = GETARG_C(i); | 1846 | unsigned int last = GETARG_C(i); |
| 1847 | Table *h = hvalue(s2v(ra)); | 1847 | Table *h = hvalue(s2v(ra)); |
| 1848 | if (n == 0) | 1848 | if (n == 0) |
| 1849 | n = cast_int(L->top - ra) - 1; /* get up to the top */ | 1849 | n = cast_int(L->top.p - ra) - 1; /* get up to the top */ |
| 1850 | else | 1850 | else |
| 1851 | L->top = ci->top; /* correct top in case of emergency GC */ | 1851 | L->top.p = ci->top.p; /* correct top in case of emergency GC */ |
| 1852 | last += n; | 1852 | last += n; |
| 1853 | if (TESTARG_k(i)) { | 1853 | if (TESTARG_k(i)) { |
| 1854 | last += GETARG_Ax(*pc) * (MAXARG_C + 1); | 1854 | last += GETARG_Ax(*pc) * (MAXARG_C + 1); |
