lvm.c File Reference

Go to the source code of this file.

Defines

#define lvm_c
#define LUA_CORE
#define MAXTAGLOOP   100
#define runtime_check(L, c)   { if (!(c)) break; }
#define RA(i)   (base+GETARG_A(i))
#define RB(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
#define RC(i)   check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
#define RKB(i)
#define RKC(i)
#define KBx(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))
#define dojump(L, pc, i)   {(pc) += (i); luai_threadyield(L);}
#define Protect(x)   { L->savedpc = pc; {x;}; base = L->base; }
#define arith_op(op, tm)

Functions

const TValueluaV_tonumber (const TValue *obj, TValue *n)
int luaV_tostring (lua_State *L, StkId obj)
static void traceexec (lua_State *L, const Instruction *pc)
static void callTMres (lua_State *L, StkId res, const TValue *f, const TValue *p1, const TValue *p2)
static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3)
void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val)
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val)
static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
static const TValueget_compTM (lua_State *L, Table *mt1, Table *mt2, TMS event)
static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event)
static int l_strcmp (const TString *ls, const TString *rs)
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r)
static int lessequal (lua_State *L, const TValue *l, const TValue *r)
int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2)
void luaV_concat (lua_State *L, int total, int last)
static void Arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op)
void luaV_execute (lua_State *L, int nexeccalls)

Define Documentation

#define arith_op ( op,
tm   ) 
Value:
{ \
        TValue *rb = RKB(i); \
        TValue *rc = RKC(i); \
        if (ttisnumber(rb) && ttisnumber(rc)) { \
          lua_Number nb = nvalue(rb), nc = nvalue(rc); \
          setnvalue(ra, op(nb, nc)); \
        } \
        else \
          Protect(Arith(L, ra, rb, rc, tm)); \
      }

Definition at line 360 of file lvm.c.

Referenced by luaV_execute().

#define dojump ( L,
pc,
 )     {(pc) += (i); luai_threadyield(L);}

Definition at line 354 of file lvm.c.

Referenced by luaV_execute().

#define KBx (  )     check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))

Definition at line 351 of file lvm.c.

Referenced by luaV_execute().

#define LUA_CORE

Definition at line 13 of file lvm.c.

#define lvm_c

Definition at line 12 of file lvm.c.

#define MAXTAGLOOP   100

Definition at line 32 of file lvm.c.

Referenced by luaV_gettable(), and luaV_settable().

#define Protect (  )     { L->savedpc = pc; {x;}; base = L->base; }

Definition at line 357 of file lvm.c.

Referenced by luaV_execute().

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

Definition at line 343 of file lvm.c.

Referenced by luaV_execute().

#define RB (  )     check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))

Definition at line 345 of file lvm.c.

Referenced by luaV_execute().

#define RC (  )     check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))

Definition at line 346 of file lvm.c.

#define RKB (  ) 
Value:

Definition at line 347 of file lvm.c.

Referenced by luaV_execute().

#define RKC (  ) 
Value:

Definition at line 349 of file lvm.c.

Referenced by luaV_execute().

#define runtime_check ( L,
 )     { if (!(c)) break; }

Definition at line 341 of file lvm.c.

Referenced by luaV_execute().


Function Documentation

static void Arith ( lua_State L,
StkId  ra,
const TValue rb,
const TValue rc,
TMS  op 
) [static]
static int call_binTM ( lua_State L,
const TValue p1,
const TValue p2,
StkId  res,
TMS  event 
) [static]

Definition at line 161 of file lvm.c.

References callTMres(), luaT_gettmbyobj(), and ttisnil.

Referenced by Arith(), luaV_concat(), and luaV_execute().

static int call_orderTM ( lua_State L,
const TValue p1,
const TValue p2,
TMS  event 
) [static]

Definition at line 186 of file lvm.c.

References callTMres(), l_isfalse, luaO_rawequalObj(), luaT_gettmbyobj(), lua_State::top, and ttisnil.

Referenced by lessequal(), and luaV_lessthan().

static void callTM ( lua_State L,
const TValue f,
const TValue p1,
const TValue p2,
const TValue p3 
) [static]

Definition at line 96 of file lvm.c.

References luaD_call(), luaD_checkstack, setobj2s, and lua_State::top.

Referenced by luaV_settable().

static void callTMres ( lua_State L,
StkId  res,
const TValue f,
const TValue p1,
const TValue p2 
) [static]
static const TValue* get_compTM ( lua_State L,
Table mt1,
Table mt2,
TMS  event 
) [static]

Definition at line 172 of file lvm.c.

References fasttm, and luaO_rawequalObj().

Referenced by luaV_equalval().

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

Definition at line 199 of file lvm.c.

References getstr, TString::len, and TString::tsv.

Referenced by lessequal(), and luaV_lessthan().

static int lessequal ( lua_State L,
const TValue l,
const TValue r 
) [static]

Definition at line 235 of file lvm.c.

References call_orderTM(), l_strcmp(), luaG_ordererror(), luai_numle, nvalue, rawtsvalue, TM_LE, TM_LT, ttisnumber, ttisstring, and ttype.

Referenced by luaV_execute().

void luaV_concat ( lua_State L,
int  total,
int  last 
)
int luaV_equalval ( lua_State L,
const TValue t1,
const TValue t2 
)
void luaV_execute ( lua_State L,
int  nexeccalls 
)

Definition at line 373 of file lvm.c.

References Arith(), arith_op, CallInfo::base, lua_State::base, call_binTM(), cast_int, cast_num, lua_State::ci, clvalue, dojump, equalobj, CallInfo::func, GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, lua_State::hookcount, lua_State::hookmask, hvalue, isLua, Proto::k, KBx, Closure::l, l_isfalse, lessequal(), LFIELDS_PER_FLUSH, lua_assert, LUA_MASKCOUNT, LUA_MASKLINE, LUA_MULTRET, LUA_QL, LUA_TSTRING, LUA_TTABLE, LUA_YIELD, luaC_barrier, luaC_barriert, luaC_checkGC, luaD_call(), luaD_checkstack, luaD_poscall(), luaD_precall(), luaF_close(), luaF_findupval(), luaF_newLclosure(), luaG_checkopenop(), luaG_runerror_1, luaG_typeerror(), luaH_getn(), luaH_new(), luaH_resizearray(), luaH_setnum(), luai_numadd, luai_numdiv, luai_numle, luai_numlt, luai_nummod, luai_nummul, luai_numpow, luai_numsub, luai_numunm, luaO_fb2int(), luaO_nilobject, luaV_concat(), luaV_gettable(), luaV_lessthan(), luaV_settable(), Proto::numparams, Proto::nups, nvalue, OP_ADD, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_FORLOOP, OP_FORPREP, OP_GETGLOBAL, OP_GETTABLE, OP_GETUPVAL, OP_JMP, OP_LE, OP_LEN, OP_LOADBOOL, OP_LOADK, OP_LOADNIL, OP_LT, OP_MOD, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETGLOBAL, OP_SETLIST, OP_SETTABLE, OP_SETUPVAL, OP_SUB, OP_TAILCALL, OP_TEST, OP_TESTSET, OP_TFORLOOP, OP_UNM, OP_VARARG, lua_State::openupval, Proto::p, LClosure::p, PCRC, PCRLUA, Protect, RA, RB, RKB, RKC, runtime_check, CallInfo::savedpc, lua_State::savedpc, setbvalue, setclvalue, sethvalue, setnilvalue, setnvalue, setobj, setobj2s, setobj2t, setobjs2s, Table::sizearray, lua_State::stack, lua_State::stacksize, lua_State::status, CallInfo::tailcalls, TM_ADD, TM_DIV, TM_LEN, TM_MOD, TM_MUL, TM_POW, TM_SUB, TM_UNM, tonumber, CallInfo::top, lua_State::top, traceexec(), tsvalue, ttisnil, ttisnumber, ttisstring, ttistable, ttype, LClosure::upvals, and UpVal::v.

Referenced by luaD_call(), and resume().

void luaV_gettable ( lua_State L,
const TValue t,
TValue key,
StkId  val 
)
int luaV_lessthan ( lua_State L,
const TValue l,
const TValue r 
)
void luaV_settable ( lua_State L,
const TValue t,
TValue key,
StkId  val 
)
const TValue* luaV_tonumber ( const TValue obj,
TValue n 
)

Definition at line 35 of file lvm.c.

References luaO_str2d(), setnvalue, svalue, ttisnumber, and ttisstring.

Referenced by Arith(), and luaG_aritherror().

int luaV_tostring ( lua_State L,
StkId  obj 
)

Definition at line 47 of file lvm.c.

References lua_number2str, LUAI_MAXNUMBER2STR, luaS_new, nvalue, setsvalue2s, and ttisnumber.

Referenced by lua_objlen(), and lua_tolstring().

static void traceexec ( lua_State L,
const Instruction pc 
) [static]

ContextLogger2—ContextLogger2 Logger Daemon Internals—Generated on Mon May 2 13:50:00 2011 by Doxygen 1.6.1