Lines Matching +full:ts +full:- +full:inv
48 /* limit for table tag-method chains (to avoid infinite loops) */
71 >> (NBM - (3 * (NBM / 4)))) > 0
76 /* check whether 'i' is in the interval [-MAXINTFITSF, MAXINTFITSF] */
228 count = l_castS2U(limit) - l_castS2U(init); in forprep()
233 count = l_castS2U(init) - l_castS2U(limit); in forprep()
235 count /= l_castS2U(-(step + 1)) + 1u; in forprep()
307 tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */ in luaV_finishget()
344 tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */ in luaV_finishset()
346 sethvalue2s(L, L->top.p, h); /* anchor 't' */ in luaV_finishset()
347 L->top.p++; /* assume EXTRA_STACK */ in luaV_finishset()
349 L->top.p--; in luaV_finishset()
378 ** Compare two strings 'ts1' x 'ts2', returning an integer less-equal-
379 ** -greater than zero if 'ts1' is less-equal-greater than 'ts2'.
400 return -1; /* 's1' is less than 's2' ('s2' is not finished) */ in l_strcmp()
403 s1 += zl1; rl1 -= zl1; s2 += zl2; rl2 -= zl2; in l_strcmp()
529 ** return 'l < r' for non-numbers.
551 ** return 'l <= r' for non-numbers.
603 tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); in luaV_equalobj()
605 tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); in luaV_equalobj()
611 tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); in luaV_equalobj()
613 tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); in luaV_equalobj()
622 luaT_callTMres(L, tm, t1, t2, L->top.p); /* call TM */ in luaV_equalobj()
623 return !l_isfalse(s2v(L->top.p)); in luaV_equalobj()
632 #define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0)
634 /* copy strings in stack from top - n up to top - 1 to buffer */
638 TString *st = tsvalue(s2v(top - n)); in copy2buff()
642 } while (--n > 0); in copy2buff()
648 ** from 'L->top.p - total' up to 'L->top.p - 1'.
654 StkId top = L->top.p; in luaV_concat()
656 if (!(ttisstring(s2v(top - 2)) || cvt2str(s2v(top - 2))) || in luaV_concat()
657 !tostring(L, s2v(top - 1))) in luaV_concat()
659 else if (isemptystr(s2v(top - 1))) /* second operand is empty? */ in luaV_concat()
660 cast_void(tostring(L, s2v(top - 2))); /* result is first operand */ in luaV_concat()
661 else if (isemptystr(s2v(top - 2))) { /* first operand is empty string? */ in luaV_concat()
662 setobjs2s(L, top - 2, top - 1); /* result is second op. */ in luaV_concat()
665 /* at least two non-empty string values; get as many as possible */ in luaV_concat()
666 size_t tl = tsslen(tsvalue(s2v(top - 1))); in luaV_concat()
667 TString *ts; in luaV_concat() local
669 for (n = 1; n < total && tostring(L, s2v(top - n - 1)); n++) { in luaV_concat()
670 size_t l = tsslen(tsvalue(s2v(top - n - 1))); in luaV_concat()
671 if (l_unlikely(l >= MAX_SIZE - sizeof(TString) - tl)) { in luaV_concat()
672 L->top.p = top - total; /* pop strings to avoid wasting stack */ in luaV_concat()
680 ts = luaS_newlstr(L, buff, tl); in luaV_concat()
683 ts = luaS_createlngstrobj(L, tl); in luaV_concat()
684 copy2buff(top, n, getlngstr(ts)); in luaV_concat()
686 setsvalue2s(L, top - n, ts); /* create result */ in luaV_concat()
688 total -= n - 1; /* got 'n' strings to create one new */ in luaV_concat()
689 L->top.p -= n - 1; /* popped 'n' strings and pushed one */ in luaV_concat()
702 tm = fasttm(L, h->metatable, TM_LEN); in luaV_objlen()
708 setivalue(s2v(ra), tsvalue(rb)->shrlen); in luaV_objlen()
712 setivalue(s2v(ra), tsvalue(rb)->u.lnglen); in luaV_objlen()
730 ** otherwise 'floor(q) == trunc(q) - 1'.
733 if (l_unlikely(l_castS2U(n) + 1u <= 1u)) { /* special cases: -1 or 0 */ in luaV_idiv()
736 return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ in luaV_idiv()
740 if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ in luaV_idiv()
741 q -= 1; /* correct result for different rounding */ in luaV_idiv()
753 if (l_unlikely(l_castS2U(n) + 1u <= 1u)) { /* special cases: -1 or 0 */ in luaV_mod()
756 return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ in luaV_mod()
760 if (r != 0 && (r ^ n) < 0) /* 'm/n' would be non-integer negative? */ in luaV_mod()
786 if (y <= -NBITS) return 0; in luaV_shiftl()
787 else return intop(>>, x, -y); in luaV_shiftl()
802 int nup = p->sizeupvalues; in pushclosure()
803 Upvaldesc *uv = p->upvalues; in pushclosure()
806 ncl->p = p; in pushclosure()
810 ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); in pushclosure()
812 ncl->upvals[i] = encup[uv[i].idx]; in pushclosure()
813 luaC_objbarrier(L, ncl, ncl->upvals[i]); in pushclosure()
822 CallInfo *ci = L->ci; in luaV_finishOp()
823 StkId base = ci->func.p + 1; in luaV_finishOp()
824 Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ in luaV_finishOp()
828 setobjs2s(L, base + GETARG_A(*(ci->u.l.savedpc - 2)), --L->top.p); in luaV_finishOp()
834 setobjs2s(L, base + GETARG_A(inst), --L->top.p); in luaV_finishOp()
841 int res = !l_isfalse(s2v(L->top.p - 1)); in luaV_finishOp()
842 L->top.p--; in luaV_finishOp()
844 if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ in luaV_finishOp()
845 ci->callstatus ^= CIST_LEQ; /* clear mark */ in luaV_finishOp()
849 lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); in luaV_finishOp()
851 ci->u.l.savedpc++; /* skip jump instruction */ in luaV_finishOp()
855 StkId top = L->top.p - 1; /* top when 'luaT_tryconcatTM' was called */ in luaV_finishOp()
857 int total = cast_int(top - 1 - (base + a)); /* yet to concatenate */ in luaV_finishOp()
858 setobjs2s(L, top - 2, top); /* put TM result in proper position */ in luaV_finishOp()
859 L->top.p = top - 1; /* top is one after last element (at top-2) */ in luaV_finishOp()
864 ci->u.l.savedpc--; /* repeat instruction to close other vars. */ in luaV_finishOp()
871 L->top.p = ra + ci->u2.nres; in luaV_finishOp()
873 ci->u.l.savedpc--; in luaV_finishOp()
896 #define l_subi(L,a,b) intop(-, a, b)
1040 #define op_orderI(L,opi,opf,inv,tm) { \ argument
1053 Protect(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \
1082 #define updatetrap(ci) (trap = ci->u.l.trap)
1084 #define updatebase(ci) (base = ci->func.p + 1)
1112 #define savepc(L) (ci->u.l.savedpc = pc)
1119 #define savestate(L,ci) (savepc(L), L->top.p = ci->top.p)
1139 { luaC_condGC(L, (savepc(L), L->top.p = (c)), \
1168 trap = L->hookmask; in luaV_execute()
1171 k = cl->p->k; in luaV_execute()
1172 pc = ci->u.l.savedpc; in luaV_execute()
1175 base = ci->func.p + 1; in luaV_execute()
1181 /* low-level line tracing for debugging Lua */ in luaV_execute()
1182 printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p))); in luaV_execute()
1184 lua_assert(base == ci->func.p + 1); in luaV_execute()
1185 lua_assert(base <= L->top.p && L->top.p <= L->stack_last.p); in luaV_execute()
1187 lua_assert(isIT(i) || (cast_void(L->top.p = base), 1)); in luaV_execute()
1240 } while (b--); in luaV_execute()
1246 setobj2s(L, ra, cl->upvals[b]->v.p); in luaV_execute()
1251 UpVal *uv = cl->upvals[GETARG_B(i)]; in luaV_execute()
1252 setobj(L, uv->v.p, s2v(ra)); in luaV_execute()
1259 TValue *upval = cl->upvals[GETARG_B(i)]->v.p; in luaV_execute()
1314 TValue *upval = cl->upvals[GETARG_A(i)]->v.p; in luaV_execute()
1374 b = 1 << (b - 1); /* size is 2^(b - 1) */ in luaV_execute()
1376 if (TESTARG_k(i)) /* non-zero extra argument? */ in luaV_execute()
1379 L->top.p = ra + 1; /* correct top in case of emergency GC */ in luaV_execute()
1453 pc++; setivalue(s2v(ra), luaV_shiftl(ib, -ic)); in luaV_execute()
1519 Instruction pi = *(pc - 2); /* original arith. expression */ in luaV_execute()
1529 Instruction pi = *(pc - 2); /* original arith. expression */ in luaV_execute()
1539 Instruction pi = *(pc - 2); /* original arith. expression */ in luaV_execute()
1553 setivalue(s2v(ra), intop(-, 0, ib)); in luaV_execute()
1590 L->top.p = ra + n; /* mark the end of concat operands */ in luaV_execute()
1592 checkGC(L, L->top.p); /* 'luaV_concat' ensures correct top */ in luaV_execute()
1602 /* create new to-be-closed upvalue */ in luaV_execute()
1684 int nresults = GETARG_C(i) - 1; in luaV_execute()
1686 L->top.p = ra + b; /* top signals number of arguments */ in luaV_execute()
1702 /* delta is virtual 'func' - real 'func' (vararg functions) */ in luaV_execute()
1703 int delta = (nparams1) ? ci->u.l.nextraargs + nparams1 : 0; in luaV_execute()
1705 L->top.p = ra + b; in luaV_execute()
1707 b = cast_int(L->top.p - ra); in luaV_execute()
1711 lua_assert(L->tbclist.p < base); /* no pending tbc variables */ in luaV_execute()
1712 lua_assert(base == ci->func.p + 1); in luaV_execute()
1717 ci->func.p -= delta; /* restore 'func' (if vararg) */ in luaV_execute()
1725 int n = GETARG_B(i) - 1; /* number of results */ in luaV_execute()
1728 n = cast_int(L->top.p - ra); /* get what is available */ in luaV_execute()
1731 ci->u2.nres = n; /* save number of returns */ in luaV_execute()
1732 if (L->top.p < ci->top.p) in luaV_execute()
1733 L->top.p = ci->top.p; in luaV_execute()
1739 ci->func.p -= ci->u.l.nextraargs + nparams1; in luaV_execute()
1740 L->top.p = ra + n; /* set call for 'luaD_poscall' */ in luaV_execute()
1746 if (l_unlikely(L->hookmask)) { in luaV_execute()
1748 L->top.p = ra; in luaV_execute()
1755 L->ci = ci->previous; /* back to caller */ in luaV_execute()
1756 L->top.p = base - 1; in luaV_execute()
1757 for (nres = ci->nresults; l_unlikely(nres > 0); nres--) in luaV_execute()
1758 setnilvalue(s2v(L->top.p++)); /* all results are nil */ in luaV_execute()
1763 if (l_unlikely(L->hookmask)) { in luaV_execute()
1765 L->top.p = ra + 1; in luaV_execute()
1771 int nres = ci->nresults; in luaV_execute()
1772 L->ci = ci->previous; /* back to caller */ in luaV_execute()
1774 L->top.p = base - 1; /* asked for no results */ in luaV_execute()
1777 setobjs2s(L, base - 1, ra); /* at least this result */ in luaV_execute()
1778 L->top.p = base; in luaV_execute()
1779 for (; l_unlikely(nres > 1); nres--) in luaV_execute()
1780 setnilvalue(s2v(L->top.p++)); /* complete missing results */ in luaV_execute()
1784 if (ci->callstatus & CIST_FRESH) in luaV_execute()
1787 ci = ci->previous; in luaV_execute()
1798 chgivalue(s2v(ra + 1), count - 1); /* update counter */ in luaV_execute()
1802 pc -= GETARG_Bx(i); /* jump back */ in luaV_execute()
1806 pc -= GETARG_Bx(i); /* jump back */ in luaV_execute()
1819 /* create to-be-closed upvalue (if needed) */ in luaV_execute()
1831 to-be-closed variable. The call will use the stack after in luaV_execute()
1836 L->top.p = ra + 4 + 3; in luaV_execute()
1848 pc -= GETARG_Bx(i); /* jump back */ in luaV_execute()
1858 n = cast_int(L->top.p - ra) - 1; /* get up to the top */ in luaV_execute()
1860 L->top.p = ci->top.p; /* correct top in case of emergency GC */ in luaV_execute()
1868 for (; n > 0; n--) { in luaV_execute()
1870 setobj2t(L, &h->array[last - 1], val); in luaV_execute()
1871 last--; in luaV_execute()
1878 Proto *p = cl->p->p[GETARG_Bx(i)]; in luaV_execute()
1879 halfProtect(pushclosure(L, p, cl->upvals, base, ra)); in luaV_execute()
1885 int n = GETARG_C(i) - 1; /* required results */ in luaV_execute()
1890 ProtectNT(luaT_adjustvarargs(L, GETARG_A(i), ci, cl->p)); in luaV_execute()
1893 L->oldpc = 1; /* next opcode will be seen as a "new" line */ in luaV_execute()