Macros | Functions
lvm.c File Reference
#include "lprefix.h"
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lvm.h"
Include dependency graph for lvm.c:

Go to the source code of this file.

Macros

#define checkGC(L, c)
 
#define docondjump()   if (cond != GETARG_k(i)) pc++; else donextjump(ci);
 
#define dojump(ci, i, e)   { pc += GETARG_sJ(i) + e; updatetrap(ci); }
 
#define donextjump(ci)   { Instruction ni = *pc; dojump(ci, ni, 1); }
 
#define halfProtect(exp)   (savestate(L,ci), (exp))
 
#define isemptystr(o)   (ttisshrstring(o) && tsvalue(o)->shrlen == 0)
 
#define KB(i)   (k+GETARG_B(i))
 
#define KC(i)   (k+GETARG_C(i))
 
#define l_addi(L, a, b)   intop(+, a, b)
 
#define l_band(a, b)   intop(&, a, b)
 
#define l_bor(a, b)   intop(|, a, b)
 
#define l_bxor(a, b)   intop(^, a, b)
 
#define l_gei(a, b)   (a >= b)
 
#define l_gti(a, b)   (a > b)
 
#define l_intfitsf(i)   1
 
#define l_lei(a, b)   (a <= b)
 
#define l_lti(a, b)   (a < b)
 
#define l_muli(L, a, b)   intop(*, a, b)
 
#define l_subi(L, a, b)   intop(-, a, b)
 
#define LUA_CORE
 
#define LUA_USE_JUMPTABLE   0
 
#define luaV_shiftr(x, y)   luaV_shiftl(x,-(y))
 
#define lvm_c
 
#define MAXTAGLOOP   2000
 
#define NBITS   cast_int(sizeof(lua_Integer) * CHAR_BIT)
 
#define NBM   (l_floatatt(MANT_DIG))
 
#define op_arith(L, iop, fop)
 
#define op_arith_aux(L, v1, v2, iop, fop)
 
#define op_arithf(L, fop)
 
#define op_arithf_aux(L, v1, v2, fop)
 
#define op_arithfK(L, fop)
 
#define op_arithI(L, iop, fop)
 
#define op_arithK(L, iop, fop)
 
#define op_bitwise(L, op)
 
#define op_bitwiseK(L, op)
 
#define op_order(L, opi, opn, other)
 
#define op_orderI(L, opi, opf, inv, tm)
 
#define Protect(exp)   (savestate(L,ci), (exp), updatetrap(ci))
 
#define ProtectNT(exp)   (savepc(L), (exp), updatetrap(ci))
 
#define RA(i)   (base+GETARG_A(i))
 
#define RB(i)   (base+GETARG_B(i))
 
#define RC(i)   (base+GETARG_C(i))
 
#define RKC(i)   ((TESTARG_k(i)) ? k + GETARG_C(i) : s2v(base + GETARG_C(i)))
 
#define savepc(L)   (ci->u.l.savedpc = pc)
 
#define savestate(L, ci)   (savepc(L), L->top = ci->top)
 
#define tostring(L, o)   (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1)))
 
#define updatebase(ci)   (base = ci->func + 1)
 
#define updatestack(ci)   { if (l_unlikely(trap)) { updatebase(ci); ra = RA(i); } }
 
#define updatetrap(ci)   (trap = ci->u.l.trap)
 
#define vmbreak   break
 
#define vmcase(l)   case l:
 
#define vmdispatch(o)   switch(o)
 
#define vmfetch()
 
#define vRB(i)   s2v(RB(i))
 
#define vRC(i)   s2v(RC(i))
 

Functions

static void copy2buff (StkId top, int n, char *buff)
 
static int floatforloop (StkId ra)
 
static int forlimit (lua_State *L, lua_Integer init, const TValue *lim, lua_Integer *p, lua_Integer step)
 
static int forprep (lua_State *L, StkId ra)
 
static int l_strcmp (const TString *ls, const TString *rs)
 
static int l_strton (const TValue *obj, TValue *result)
 
static int LEfloatint (lua_Number f, lua_Integer i)
 
static int LEintfloat (lua_Integer i, lua_Number f)
 
static int LEnum (const TValue *l, const TValue *r)
 
static int lessequalothers (lua_State *L, const TValue *l, const TValue *r)
 
static int lessthanothers (lua_State *L, const TValue *l, const TValue *r)
 
static int LTfloatint (lua_Number f, lua_Integer i)
 
static int LTintfloat (lua_Integer i, lua_Number f)
 
static int LTnum (const TValue *l, const TValue *r)
 
void luaV_concat (lua_State *L, int total)
 
int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2)
 
void luaV_execute (lua_State *L, CallInfo *ci)
 
void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
 
void luaV_finishOp (lua_State *L)
 
void luaV_finishset (lua_State *L, const TValue *t, TValue *key, TValue *val, const TValue *slot)
 
int luaV_flttointeger (lua_Number n, lua_Integer *p, F2Imod mode)
 
lua_Integer luaV_idiv (lua_State *L, lua_Integer m, lua_Integer n)
 
int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r)
 
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r)
 
lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n)
 
lua_Number luaV_modf (lua_State *L, lua_Number m, lua_Number n)
 
void luaV_objlen (lua_State *L, StkId ra, const TValue *rb)
 
lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y)
 
int luaV_tointeger (const TValue *obj, lua_Integer *p, F2Imod mode)
 
int luaV_tointegerns (const TValue *obj, lua_Integer *p, F2Imod mode)
 
int luaV_tonumber_ (const TValue *obj, lua_Number *n)
 
static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra)
 

Macro Definition Documentation

◆ checkGC

#define checkGC (   L,
 
)
Value:
{ luaC_condGC(L, (savepc(L), L->top = (c)), \
updatetrap(ci)); \
luai_threadyield(L); }

Definition at line 1108 of file lvm.c.

◆ docondjump

#define docondjump ( )    if (cond != GETARG_k(i)) pc++; else donextjump(ci);

Definition at line 1076 of file lvm.c.

◆ dojump

#define dojump (   ci,
  i,
 
)    { pc += GETARG_sJ(i) + e; updatetrap(ci); }

Definition at line 1065 of file lvm.c.

◆ donextjump

#define donextjump (   ci)    { Instruction ni = *pc; dojump(ci, ni, 1); }

Definition at line 1069 of file lvm.c.

◆ halfProtect

#define halfProtect (   exp)    (savestate(L,ci), (exp))

Definition at line 1105 of file lvm.c.

◆ isemptystr

#define isemptystr (   o)    (ttisshrstring(o) && tsvalue(o)->shrlen == 0)

Definition at line 621 of file lvm.c.

◆ KB

#define KB (   i)    (k+GETARG_B(i))

Definition at line 1044 of file lvm.c.

◆ KC

#define KC (   i)    (k+GETARG_C(i))

Definition at line 1047 of file lvm.c.

◆ l_addi

#define l_addi (   L,
  a,
 
)    intop(+, a, b)

Definition at line 873 of file lvm.c.

◆ l_band

#define l_band (   a,
 
)    intop(&, a, b)

Definition at line 876 of file lvm.c.

◆ l_bor

#define l_bor (   a,
 
)    intop(|, a, b)

Definition at line 877 of file lvm.c.

◆ l_bxor

#define l_bxor (   a,
 
)    intop(^, a, b)

Definition at line 878 of file lvm.c.

◆ l_gei

#define l_gei (   a,
 
)    (a >= b)

Definition at line 883 of file lvm.c.

◆ l_gti

#define l_gti (   a,
 
)    (a > b)

Definition at line 882 of file lvm.c.

◆ l_intfitsf

#define l_intfitsf (   i)    1

Definition at line 78 of file lvm.c.

◆ l_lei

#define l_lei (   a,
 
)    (a <= b)

Definition at line 881 of file lvm.c.

◆ l_lti

#define l_lti (   a,
 
)    (a < b)

Definition at line 880 of file lvm.c.

◆ l_muli

#define l_muli (   L,
  a,
 
)    intop(*, a, b)

Definition at line 875 of file lvm.c.

◆ l_subi

#define l_subi (   L,
  a,
 
)    intop(-, a, b)

Definition at line 874 of file lvm.c.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lvm.c.

◆ LUA_USE_JUMPTABLE

#define LUA_USE_JUMPTABLE   0

Definition at line 42 of file lvm.c.

◆ luaV_shiftr

#define luaV_shiftr (   x,
 
)    luaV_shiftl(x,-(y))

Definition at line 769 of file lvm.c.

◆ lvm_c

#define lvm_c

Definition at line 7 of file lvm.c.

◆ MAXTAGLOOP

#define MAXTAGLOOP   2000

Definition at line 49 of file lvm.c.

◆ NBITS

#define NBITS   cast_int(sizeof(lua_Integer) * CHAR_BIT)

Definition at line 764 of file lvm.c.

◆ NBM

#define NBM   (l_floatatt(MANT_DIG))

Definition at line 58 of file lvm.c.

◆ op_arith

#define op_arith (   L,
  iop,
  fop 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = vRC(i); \
op_arith_aux(L, v1, v2, iop, fop); }

Definition at line 947 of file lvm.c.

◆ op_arith_aux

#define op_arith_aux (   L,
  v1,
  v2,
  iop,
  fop 
)
Value:
{ \
if (ttisinteger(v1) && ttisinteger(v2)) { \
lua_Integer i1 = ivalue(v1); lua_Integer i2 = ivalue(v2); \
pc++; setivalue(s2v(ra), iop(L, i1, i2)); \
} \
else op_arithf_aux(L, v1, v2, fop); }

Definition at line 936 of file lvm.c.

◆ op_arithf

#define op_arithf (   L,
  fop 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = vRC(i); \
op_arithf_aux(L, v1, v2, fop); }

Definition at line 918 of file lvm.c.

◆ op_arithf_aux

#define op_arithf_aux (   L,
  v1,
  v2,
  fop 
)
Value:
{ \
lua_Number n1; lua_Number n2; \
if (tonumberns(v1, n1) && tonumberns(v2, n2)) { \
pc++; setfltvalue(s2v(ra), fop(L, n1, n2)); \
}}

Definition at line 908 of file lvm.c.

◆ op_arithfK

#define op_arithfK (   L,
  fop 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \
op_arithf_aux(L, v1, v2, fop); }

Definition at line 927 of file lvm.c.

◆ op_arithI

#define op_arithI (   L,
  iop,
  fop 
)
Value:
{ \
TValue *v1 = vRB(i); \
int imm = GETARG_sC(i); \
if (ttisinteger(v1)) { \
lua_Integer iv1 = ivalue(v1); \
pc++; setivalue(s2v(ra), iop(L, iv1, imm)); \
} \
else if (ttisfloat(v1)) { \
lua_Number nb = fltvalue(v1); \
lua_Number fimm = cast_num(imm); \
pc++; setfltvalue(s2v(ra), fop(L, nb, fimm)); \
}}

Definition at line 890 of file lvm.c.

◆ op_arithK

#define op_arithK (   L,
  iop,
  fop 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = KC(i); lua_assert(ttisnumber(v2)); \
op_arith_aux(L, v1, v2, iop, fop); }

Definition at line 956 of file lvm.c.

◆ op_bitwise

#define op_bitwise (   L,
  op 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = vRC(i); \
lua_Integer i1; lua_Integer i2; \
if (tointegerns(v1, &i1) && tointegerns(v2, &i2)) { \
pc++; setivalue(s2v(ra), op(i1, i2)); \
}}

Definition at line 978 of file lvm.c.

◆ op_bitwiseK

#define op_bitwiseK (   L,
  op 
)
Value:
{ \
TValue *v1 = vRB(i); \
TValue *v2 = KC(i); \
lua_Integer i1; \
lua_Integer i2 = ivalue(v2); \
if (tointegerns(v1, &i1)) { \
pc++; setivalue(s2v(ra), op(i1, i2)); \
}}

Definition at line 965 of file lvm.c.

◆ op_order

#define op_order (   L,
  opi,
  opn,
  other 
)
Value:
{ \
int cond; \
TValue *rb = vRB(i); \
if (ttisinteger(s2v(ra)) && ttisinteger(rb)) { \
lua_Integer ia = ivalue(s2v(ra)); \
lua_Integer ib = ivalue(rb); \
cond = opi(ia, ib); \
} \
else if (ttisnumber(s2v(ra)) && ttisnumber(rb)) \
cond = opn(s2v(ra), rb); \
Protect(cond = other(L, s2v(ra), rb)); \
docondjump(); }

Definition at line 992 of file lvm.c.

◆ op_orderI

#define op_orderI (   L,
  opi,
  opf,
  inv,
  tm 
)
Value:
{ \
int cond; \
int im = GETARG_sB(i); \
if (ttisinteger(s2v(ra))) \
cond = opi(ivalue(s2v(ra)), im); \
else if (ttisfloat(s2v(ra))) { \
lua_Number fa = fltvalue(s2v(ra)); \
lua_Number fim = cast_num(im); \
cond = opf(fa, fim); \
} \
else { \
int isf = GETARG_C(i); \
Protect(cond = luaT_callorderiTM(L, s2v(ra), im, inv, isf, tm)); \
} \
docondjump(); }

Definition at line 1011 of file lvm.c.

◆ Protect

#define Protect (   exp)    (savestate(L,ci), (exp), updatetrap(ci))

Definition at line 1096 of file lvm.c.

◆ ProtectNT

#define ProtectNT (   exp)    (savepc(L), (exp), updatetrap(ci))

Definition at line 1099 of file lvm.c.

◆ RA

#define RA (   i)    (base+GETARG_A(i))

Definition at line 1041 of file lvm.c.

◆ RB

#define RB (   i)    (base+GETARG_B(i))

Definition at line 1042 of file lvm.c.

◆ RC

#define RC (   i)    (base+GETARG_C(i))

Definition at line 1045 of file lvm.c.

◆ RKC

#define RKC (   i)    ((TESTARG_k(i)) ? k + GETARG_C(i) : s2v(base + GETARG_C(i)))

Definition at line 1048 of file lvm.c.

◆ savepc

#define savepc (   L)    (ci->u.l.savedpc = pc)

Definition at line 1082 of file lvm.c.

◆ savestate

#define savestate (   L,
  ci 
)    (savepc(L), L->top = ci->top)

Definition at line 1089 of file lvm.c.

◆ tostring

#define tostring (   L,
 
)    (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1)))

Definition at line 618 of file lvm.c.

◆ updatebase

#define updatebase (   ci)    (base = ci->func + 1)

Definition at line 1054 of file lvm.c.

◆ updatestack

#define updatestack (   ci)    { if (l_unlikely(trap)) { updatebase(ci); ra = RA(i); } }

Definition at line 1057 of file lvm.c.

◆ updatetrap

#define updatetrap (   ci)    (trap = ci->u.l.trap)

Definition at line 1052 of file lvm.c.

◆ vmbreak

#define vmbreak   break

Definition at line 1126 of file lvm.c.

◆ vmcase

#define vmcase (   l)    case l:

Definition at line 1125 of file lvm.c.

◆ vmdispatch

#define vmdispatch (   o)    switch(o)

Definition at line 1124 of file lvm.c.

◆ vmfetch

#define vmfetch ( )
Value:
{ \
if (l_unlikely(trap)) { /* stack reallocation or hooks? */ \
trap = luaG_traceexec(L, pc); /* handle hooks */ \
updatebase(ci); /* correct stack */ \
} \
i = *(pc++); \
ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \
}

Definition at line 1115 of file lvm.c.

◆ vRB

#define vRB (   i)    s2v(RB(i))

Definition at line 1043 of file lvm.c.

◆ vRC

#define vRC (   i)    s2v(RC(i))

Definition at line 1046 of file lvm.c.

Function Documentation

◆ copy2buff()

static void copy2buff ( StkId  top,
int  n,
char *  buff 
)
static

Definition at line 624 of file lvm.c.

◆ floatforloop()

static int floatforloop ( StkId  ra)
static

Definition at line 266 of file lvm.c.

◆ forlimit()

static int forlimit ( lua_State L,
lua_Integer  init,
const TValue lim,
lua_Integer p,
lua_Integer  step 
)
static

Definition at line 176 of file lvm.c.

◆ forprep()

static int forprep ( lua_State L,
StkId  ra 
)
static

Definition at line 206 of file lvm.c.

◆ l_strcmp()

static int l_strcmp ( const TString ls,
const TString rs 
)
static

Definition at line 375 of file lvm.c.

◆ l_strton()

static int l_strton ( const TValue obj,
TValue result 
)
static

Definition at line 90 of file lvm.c.

◆ LEfloatint()

static int LEfloatint ( lua_Number  f,
lua_Integer  i 
)
static

Definition at line 460 of file lvm.c.

◆ LEintfloat()

static int LEintfloat ( lua_Integer  i,
lua_Number  f 
)
static

Definition at line 426 of file lvm.c.

◆ LEnum()

static int LEnum ( const TValue l,
const TValue r 
)
static

Definition at line 498 of file lvm.c.

◆ lessequalothers()

static int lessequalothers ( lua_State L,
const TValue l,
const TValue r 
)
static

Definition at line 542 of file lvm.c.

◆ lessthanothers()

static int lessthanothers ( lua_State L,
const TValue l,
const TValue r 
)
static

Definition at line 520 of file lvm.c.

◆ LTfloatint()

static int LTfloatint ( lua_Number  f,
lua_Integer  i 
)
static

Definition at line 443 of file lvm.c.

◆ LTintfloat()

static int LTintfloat ( lua_Integer  i,
lua_Number  f 
)
static

Definition at line 409 of file lvm.c.

◆ LTnum()

static int LTnum ( const TValue l,
const TValue r 
)
static

Definition at line 476 of file lvm.c.

◆ luaV_concat()

void luaV_concat ( lua_State L,
int  total 
)

Definition at line 638 of file lvm.c.

◆ luaV_equalobj()

int luaV_equalobj ( lua_State L,
const TValue t1,
const TValue t2 
)

Definition at line 565 of file lvm.c.

◆ luaV_execute()

void luaV_execute ( lua_State L,
CallInfo ci 
)

Definition at line 1129 of file lvm.c.

◆ luaV_finishget()

void luaV_finishget ( lua_State L,
const TValue t,
TValue key,
StkId  val,
const TValue slot 
)

Definition at line 287 of file lvm.c.

◆ luaV_finishOp()

void luaV_finishOp ( lua_State L)

Definition at line 808 of file lvm.c.

◆ luaV_finishset()

void luaV_finishset ( lua_State L,
const TValue t,
TValue key,
TValue val,
const TValue slot 
)

Definition at line 330 of file lvm.c.

◆ luaV_flttointeger()

int luaV_flttointeger ( lua_Number  n,
lua_Integer p,
F2Imod  mode 
)

Definition at line 121 of file lvm.c.

◆ luaV_idiv()

lua_Integer luaV_idiv ( lua_State L,
lua_Integer  m,
lua_Integer  n 
)

Definition at line 718 of file lvm.c.

◆ luaV_lessequal()

int luaV_lessequal ( lua_State L,
const TValue l,
const TValue r 
)

Definition at line 554 of file lvm.c.

◆ luaV_lessthan()

int luaV_lessthan ( lua_State L,
const TValue l,
const TValue r 
)

Definition at line 532 of file lvm.c.

◆ luaV_mod()

lua_Integer luaV_mod ( lua_State L,
lua_Integer  m,
lua_Integer  n 
)

Definition at line 738 of file lvm.c.

◆ luaV_modf()

lua_Number luaV_modf ( lua_State L,
lua_Number  m,
lua_Number  n 
)

Definition at line 756 of file lvm.c.

◆ luaV_objlen()

void luaV_objlen ( lua_State L,
StkId  ra,
const TValue rb 
)

Definition at line 683 of file lvm.c.

◆ luaV_shiftl()

lua_Integer luaV_shiftl ( lua_Integer  x,
lua_Integer  y 
)

Definition at line 771 of file lvm.c.

◆ luaV_tointeger()

int luaV_tointeger ( const TValue obj,
lua_Integer p,
F2Imod  mode 
)

Definition at line 152 of file lvm.c.

◆ luaV_tointegerns()

int luaV_tointegerns ( const TValue obj,
lua_Integer p,
F2Imod  mode 
)

Definition at line 137 of file lvm.c.

◆ luaV_tonumber_()

int luaV_tonumber_ ( const TValue obj,
lua_Number n 
)

Definition at line 103 of file lvm.c.

◆ pushclosure()

static void pushclosure ( lua_State L,
Proto p,
UpVal **  encup,
StkId  base,
StkId  ra 
)
static

Definition at line 787 of file lvm.c.

s2v
#define s2v(o)
Definition: lobject.h:159
op
#define op
lua_assert
#define lua_assert(c)
Definition: lauxlib.h:170
updatetrap
#define updatetrap(ci)
Definition: lvm.c:1052
cond
static int cond(LexState *ls)
Definition: lparser.c:1394
KC
#define KC(i)
Definition: lvm.c:1047
ttisinteger
#define ttisinteger(o)
Definition: lobject.h:315
lua_Number
LUA_NUMBER lua_Number
Definition: lua.h:90
GETARG_sC
#define GETARG_sC(i)
Definition: lopcodes.h:133
tointegerns
#define tointegerns(o, i)
Definition: lvm.h:68
op_arithf_aux
#define op_arithf_aux(L, v1, v2, fop)
Definition: lvm.c:908
fltvalue
#define fltvalue(o)
Definition: lobject.h:319
ivalue
#define ivalue(o)
Definition: lobject.h:320
luaG_traceexec
int luaG_traceexec(lua_State *L, const Instruction *pc)
Definition: ldebug.c:833
GETARG_sB
#define GETARG_sB(i)
Definition: lopcodes.h:129
RA
#define RA(i)
Definition: lvm.c:1041
savepc
#define savepc(L)
Definition: lvm.c:1082
vRC
#define vRC(i)
Definition: lvm.c:1046
lua_Integer
LUA_INTEGER lua_Integer
Definition: lua.h:94
vRB
#define vRB(i)
Definition: lvm.c:1043
tonumberns
#define tonumberns(o, n)
Definition: lvm.h:56
setivalue
#define setivalue(obj, x)
Definition: lobject.h:331
Protect
#define Protect(exp)
Definition: lvm.c:1096
ttisnumber
#define ttisnumber(o)
Definition: lobject.h:313
setfltvalue
#define setfltvalue(obj, x)
Definition: lobject.h:325
luaT_callorderiTM
int luaT_callorderiTM(lua_State *L, const TValue *p1, int v2, int flip, int isfloat, TMS event)
Definition: ltm.c:221
luaC_condGC
#define luaC_condGC(L, pre, pos)
Definition: lgc.h:157
GETARG_C
#define GETARG_C(i)
Definition: lopcodes.h:132
cast_num
#define cast_num(i)
Definition: llimits.h:127
ttisfloat
#define ttisfloat(o)
Definition: lobject.h:314


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:49