Go to the documentation of this file.
38 #if !defined(LUA_USE_JUMPTABLE)
40 #define LUA_USE_JUMPTABLE 1
42 #define LUA_USE_JUMPTABLE 0
49 #define MAXTAGLOOP 2000
58 #define NBM (l_floatatt(MANT_DIG))
67 #if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \
68 >> (NBM - (3 * (NBM / 4)))) > 0
71 #define MAXINTFITSF ((lua_Unsigned)1 << NBM)
74 #define l_intfitsf(i) ((MAXINTFITSF + l_castS2U(i)) <= (2 * MAXINTFITSF))
78 #define l_intfitsf(i) 1
124 if (mode ==
F2Ieq)
return 0;
185 if (step < 0)
return 1;
189 if (step > 0)
return 1;
193 return (step > 0 ?
init > *p :
init < *p);
238 if (l_unlikely(!
tonumber(plimit, &limit)))
240 if (l_unlikely(!
tonumber(pstep, &step)))
295 if (l_unlikely(
notm(tm)))
349 if (l_unlikely(
notm(tm)))
364 luaG_runerror(L,
"'__newindex' chain too long; possible loop");
376 const char *l =
getstr(ls);
378 const char *r =
getstr(rs);
381 int temp = strcoll(l, r);
385 size_t len = strlen(l);
387 return (len == ll) ? 0 : 1;
392 l += len; ll -= len; r += len; lr -= len;
591 else if (L == NULL)
return 0;
599 else if (L == NULL)
return 0;
618 #define tostring(L,o) \
619 (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1)))
621 #define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0)
628 memcpy(buff + tl,
svalue(
s2v(
top - n)), l *
sizeof(
char));
659 if (l_unlikely(l >= (
MAX_SIZE/
sizeof(
char)) - tl))
703 if (l_unlikely(
notm(tm)))
719 if (l_unlikely(
l_castS2U(n) + 1u <= 1u)) {
722 return intop(-, 0, m);
726 if ((m ^ n) < 0 && m % n != 0)
739 if (l_unlikely(
l_castS2U(n) + 1u <= 1u)) {
746 if (r != 0 && (r ^ n) < 0)
764 #define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT)
769 #define luaV_shiftr(x,y) luaV_shiftl(x,-(y))
773 if (
y <= -
NBITS)
return 0;
795 for (i = 0; i < nup; i++) {
830 #if defined(LUA_COMPAT_LT_LE)
873 #define l_addi(L,a,b) intop(+, a, b)
874 #define l_subi(L,a,b) intop(-, a, b)
875 #define l_muli(L,a,b) intop(*, a, b)
876 #define l_band(a,b) intop(&, a, b)
877 #define l_bor(a,b) intop(|, a, b)
878 #define l_bxor(a,b) intop(^, a, b)
880 #define l_lti(a,b) (a < b)
881 #define l_lei(a,b) (a <= b)
882 #define l_gti(a,b) (a > b)
883 #define l_gei(a,b) (a >= b)
890 #define op_arithI(L,iop,fop) { \
891 TValue *v1 = vRB(i); \
892 int imm = GETARG_sC(i); \
893 if (ttisinteger(v1)) { \
894 lua_Integer iv1 = ivalue(v1); \
895 pc++; setivalue(s2v(ra), iop(L, iv1, imm)); \
897 else if (ttisfloat(v1)) { \
898 lua_Number nb = fltvalue(v1); \
899 lua_Number fimm = cast_num(imm); \
900 pc++; setfltvalue(s2v(ra), fop(L, nb, fimm)); \
908 #define op_arithf_aux(L,v1,v2,fop) { \
909 lua_Number n1; lua_Number n2; \
910 if (tonumberns(v1, n1) && tonumberns(v2, n2)) { \
911 pc++; setfltvalue(s2v(ra), fop(L, n1, n2)); \
918 #define op_arithf(L,fop) { \
919 TValue *v1 = vRB(i); \
920 TValue *v2 = vRC(i); \
921 op_arithf_aux(L, v1, v2, fop); }
927 #define op_arithfK(L,fop) { \
928 TValue *v1 = vRB(i); \
929 TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \
930 op_arithf_aux(L, v1, v2, fop); }
936 #define op_arith_aux(L,v1,v2,iop,fop) { \
937 if (ttisinteger(v1) && ttisinteger(v2)) { \
938 lua_Integer i1 = ivalue(v1); lua_Integer i2 = ivalue(v2); \
939 pc++; setivalue(s2v(ra), iop(L, i1, i2)); \
941 else op_arithf_aux(L, v1, v2, fop); }
947 #define op_arith(L,iop,fop) { \
948 TValue *v1 = vRB(i); \
949 TValue *v2 = vRC(i); \
950 op_arith_aux(L, v1, v2, iop, fop); }
956 #define op_arithK(L,iop,fop) { \
957 TValue *v1 = vRB(i); \
958 TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \
959 op_arith_aux(L, v1, v2, iop, fop); }
965 #define op_bitwiseK(L,op) { \
966 TValue *v1 = vRB(i); \
967 TValue *v2 = KC(i); \
969 lua_Integer i2 = ivalue(v2); \
970 if (tointegerns(v1, &i1)) { \
971 pc++; setivalue(s2v(ra), op(i1, i2)); \
978 #define op_bitwise(L,op) { \
979 TValue *v1 = vRB(i); \
980 TValue *v2 = vRC(i); \
981 lua_Integer i1; lua_Integer i2; \
982 if (tointegerns(v1, &i1) && tointegerns(v2, &i2)) { \
983 pc++; setivalue(s2v(ra), op(i1, i2)); \
992 #define op_order(L,opi,opn,other) { \
994 TValue *rb = vRB(i); \
995 if (ttisinteger(s2v(ra)) && ttisinteger(rb)) { \
996 lua_Integer ia = ivalue(s2v(ra)); \
997 lua_Integer ib = ivalue(rb); \
998 cond = opi(ia, ib); \
1000 else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \
1001 cond = opn(s2v(ra), rb); \
1003 Protect(cond = other(L, s2v(ra), rb)); \
1011 #define op_orderI(L,opi,opf,inv,tm) { \
1013 int im = GETARG_sB(i); \
1014 if (ttisinteger(s2v(ra))) \
1015 cond = opi(ivalue(s2v(ra)), im); \
1016 else if (ttisfloat(s2v(ra))) { \
1017 lua_Number fa = fltvalue(s2v(ra)); \
1018 lua_Number fim = cast_num(im); \
1019 cond = opf(fa, fim); \
1022 int isf = GETARG_C(i); \
1023 Protect(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \
1041 #define RA(i) (base+GETARG_A(i))
1042 #define RB(i) (base+GETARG_B(i))
1043 #define vRB(i) s2v(RB(i))
1044 #define KB(i) (k+GETARG_B(i))
1045 #define RC(i) (base+GETARG_C(i))
1046 #define vRC(i) s2v(RC(i))
1047 #define KC(i) (k+GETARG_C(i))
1048 #define RKC(i) ((TESTARG_k(i)) ? k + GETARG_C(i) : s2v(base + GETARG_C(i)))
1052 #define updatetrap(ci) (trap = ci->u.l.trap)
1054 #define updatebase(ci) (base = ci->func + 1)
1057 #define updatestack(ci) \
1058 { if (l_unlikely(trap)) { updatebase(ci); ra = RA(i); } }
1065 #define dojump(ci,i,e) { pc += GETARG_sJ(i) + e; updatetrap(ci); }
1069 #define donextjump(ci) { Instruction ni = *pc; dojump(ci, ni, 1); }
1076 #define docondjump() if (cond != GETARG_k(i)) pc++; else donextjump(ci);
1082 #define savepc(L) (ci->u.l.savedpc = pc)
1089 #define savestate(L,ci) (savepc(L), L->top = ci->top)
1096 #define Protect(exp) (savestate(L,ci), (exp), updatetrap(ci))
1099 #define ProtectNT(exp) (savepc(L), (exp), updatetrap(ci))
1105 #define halfProtect(exp) (savestate(L,ci), (exp))
1108 #define checkGC(L,c) \
1109 { luaC_condGC(L, (savepc(L), L->top = (c)), \
1111 luai_threadyield(L); }
1115 #define vmfetch() { \
1116 if (l_unlikely(trap)) { \
1117 trap = luaG_traceexec(L, pc); \
1124 #define vmdispatch(o) switch(o)
1125 #define vmcase(l) case l:
1126 #define vmbreak break
1135 #if LUA_USE_JUMPTABLE
1143 pc = ci->
u.
l.savedpc;
1144 if (l_unlikely(trap)) {
1145 if (pc == cl->
p->
code) {
1153 base = ci->
func + 1;
1340 if (b != 0 || c != 0)
1637 int delta = (nparams1) ? ci->
u.
l.nextraargs + nparams1 : 0;
1680 ci->
func -= ci->
u.
l.nextraargs + nparams1;
1697 for (nres = ci->
nresults; l_unlikely(nres > 0); nres--)
1717 for (; l_unlikely(nres > 1); nres--)
1736 idx =
intop(+, idx, step);
1769 memcpy(ra + 4, ra, 3 *
sizeof(*ra));
1770 L->
top = ra + 4 + 3;
1800 for (; n > 0; n--) {
1821 if (l_unlikely(trap)) {
void luaT_callTM(lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3)
lua_Integer luaV_mod(lua_State *L, lua_Integer m, lua_Integer n)
static int l_strton(const TValue *obj, TValue *result)
#define setobjs2s(L, o1, o2)
int luaV_equalobj(lua_State *L, const TValue *t1, const TValue *t2)
#define luai_numsub(L, a, b)
#define op_orderI(L, opi, opf, inv, tm)
struct CallInfo * previous
#define luai_numunm(L, a)
LUA_UNSIGNED lua_Unsigned
#define luaV_fastgeti(L, t, k, slot)
#define op_arithfK(L, fop)
void luaD_poscall(lua_State *L, CallInfo *ci, int nres)
TString * luaS_newlstr(lua_State *L, const char *str, size_t l)
#define luaV_finishfastset(L, t, slot, v)
#define luaC_objbarrier(L, p, o)
#define op_arithK(L, iop, fop)
static int cond(LexState *ls)
#define luaC_barrierback(L, p, v)
l_noret luaG_runerror(lua_State *L, const char *fmt,...)
static int lessequalothers(lua_State *L, const TValue *l, const TValue *r)
#define op_arith(L, iop, fop)
void luaV_finishOp(lua_State *L)
lua_Integer luaV_shiftl(lua_Integer x, lua_Integer y)
static int forprep(lua_State *L, StkId ra)
static int lessthanothers(lua_State *L, const TValue *l, const TValue *r)
void luaF_closeupval(lua_State *L, StkId level)
#define invalidateTMcache(t)
#define luai_nummod(L, a, b, m)
CallInfo * luaD_precall(lua_State *L, StkId func, int nresults)
const TValue * luaH_getshortstr(Table *t, TString *key)
#define tointegerns(o, i)
#define luaV_rawequalobj(t1, t2)
void luaH_resize(lua_State *L, Table *t, unsigned int newasize, unsigned int nhsize)
#define luai_numidiv(L, a, b)
void luaH_resizearray(lua_State *L, Table *t, unsigned int nasize)
unsigned short callstatus
void luaD_pretailcall(lua_State *L, CallInfo *ci, StkId func, int narg1)
#define op_arithI(L, iop, fop)
constexpr auto count() -> size_t
void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
#define luai_numpow(L, a, b)
#define op_bitwiseK(L, op)
static int l_strcmp(const TString *ls, const TString *rs)
int luaV_tonumber_(const TValue *obj, lua_Number *n)
lua_Number luaV_modf(lua_State *L, lua_Number m, lua_Number n)
const TValue * luaH_get(Table *t, const TValue *key)
int luaV_lessequal(lua_State *L, const TValue *l, const TValue *r)
void luaF_close(lua_State *L, StkId level, int status, int yy)
void luaV_finishset(lua_State *L, const TValue *t, TValue *key, TValue *val, const TValue *slot)
#define lua_numbertointeger(n, p)
l_noret luaG_typeerror(lua_State *L, const TValue *o, const char *op)
#define op_arithf(L, fop)
#define setclLvalue2s(L, o, cl)
void luaF_newtbcupval(lua_State *L, StkId level)
#define setsvalue2s(L, o, s)
int luaV_flttointeger(lua_Number n, lua_Integer *p, F2Imod mode)
void luaD_call(lua_State *L, StkId func, int nResults)
#define setobj(L, obj1, obj2)
#define luaV_shiftr(x, y)
#define op_bitwise(L, op)
#define op_order(L, opi, opn, other)
const TValue * luaH_getstr(Table *t, TString *key)
void luaV_objlen(lua_State *L, StkId ra, const TValue *rb)
LUAI_FUNC unsigned int luaH_realasize(const Table *t)
void luaT_getvarargs(lua_State *L, CallInfo *ci, StkId where, int wanted)
Table * luaH_new(lua_State *L)
#define luai_numdiv(L, a, b)
#define LUA_VLIGHTUSERDATA
static void copy2buff(StkId top, int n, char *buff)
#define chgivalue(obj, x)
static int LEfloatint(lua_Number f, lua_Integer i)
#define luai_numadd(L, a, b)
static int LEintfloat(lua_Integer i, lua_Number f)
#define intop(op, v1, v2)
#define luai_nummul(L, a, b)
static int LEnum(const TValue *l, const TValue *r)
static int LTintfloat(lua_Integer i, lua_Number f)
lua_Unsigned luaH_getn(Table *t)
void luaV_execute(lua_State *L, CallInfo *ci)
void luaT_adjustvarargs(lua_State *L, int nfixparams, CallInfo *ci, const Proto *p)
volatile l_signalT hookmask
size_t luaO_str2num(const char *s, TValue *o)
void luaT_callTMres(lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, StkId res)
void luaV_concat(lua_State *L, int total)
#define setivalue(obj, x)
#define sethvalue2s(L, o, h)
void luaT_trybinassocTM(lua_State *L, const TValue *p1, const TValue *p2, int flip, StkId res, TMS event)
static int floatforloop(StkId ra)
int luaT_callorderTM(lua_State *L, const TValue *p1, const TValue *p2, TMS event)
int luaV_tointegerns(const TValue *obj, lua_Integer *p, F2Imod mode)
void luaT_trybiniTM(lua_State *L, const TValue *p1, lua_Integer i2, int flip, StkId res, TMS event)
const TValue * luaT_gettmbyobj(lua_State *L, const TValue *o, TMS event)
#define setobj2s(L, o1, o2)
LClosure * luaF_newLclosure(lua_State *L, int nupvals)
void init(const M_string &remappings)
#define chgfltvalue(obj, x)
UpVal * luaF_findupval(lua_State *L, StkId level)
#define setfltvalue(obj, x)
lua_Integer luaV_idiv(lua_State *L, lua_Integer m, lua_Integer n)
#define luaV_fastget(L, t, k, slot, f)
static int LTnum(const TValue *l, const TValue *r)
#define checkstackGCp(L, n, p)
basic_metatable< reference > metatable
void luaD_hookcall(lua_State *L, CallInfo *ci)
TString * luaS_createlngstrobj(lua_State *L, size_t l)
int luaV_lessthan(lua_State *L, const TValue *l, const TValue *r)
void luaD_tryfuncTM(lua_State *L, StkId func)
void luaT_trybinTM(lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
static int LTfloatint(lua_Number f, lua_Integer i)
int luaS_eqlngstr(TString *a, TString *b)
void luaH_finishset(lua_State *L, Table *t, const TValue *key, const TValue *slot, TValue *value)
static int forlimit(lua_State *L, lua_Integer init, const TValue *lim, lua_Integer *p, lua_Integer step)
l_noret luaG_forerror(lua_State *L, const TValue *o, const char *what)
#define luaC_barrier(L, p, v)
int luaV_tointeger(const TValue *obj, lua_Integer *p, F2Imod mode)
struct CallInfo::@12::@14 l
static void pushclosure(lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra)
void luaT_tryconcatTM(lua_State *L)
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45