Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

lua/lvm.c File Reference

#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.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.

Defines

#define lvm_c
#define lua_number2str(s, n)   sprintf((s), LUA_NUMBER_FMT, (n))
#define MAXTAGLOOP   100
#define runtime_check(L, c)   { if (!(c)) return 0; }
#define RA(i)   (base+GETARG_A(i))
#define XRA(i)   (L->base+GETARG_A(i))
#define RB(i)   (base+GETARG_B(i))
#define RKB(i)   ((GETARG_B(i) < MAXSTACK) ? RB(i) : k+GETARG_B(i)-MAXSTACK)
#define RC(i)   (base+GETARG_C(i))
#define RKC(i)   ((GETARG_C(i) < MAXSTACK) ? RC(i) : k+GETARG_C(i)-MAXSTACK)
#define KBx(i)   (k+GETARG_Bx(i))
#define dojump(pc, i)   ((pc) += (i))

Functions

const TObjectluaV_tonumber (const TObject *obj, TObject *n)
int luaV_tostring (lua_State *L, StkId obj)
static void traceexec (lua_State *L)
static void callTMres (lua_State *L, const TObject *f, const TObject *p1, const TObject *p2)
static void callTM (lua_State *L, const TObject *f, const TObject *p1, const TObject *p2, const TObject *p3)
static const TObjectluaV_index (lua_State *L, const TObject *t, TObject *key, int loop)
static const TObjectluaV_getnotable (lua_State *L, const TObject *t, TObject *key, int loop)
const TObjectluaV_gettable (lua_State *L, const TObject *t, TObject *key, int loop)
void luaV_settable (lua_State *L, const TObject *t, TObject *key, StkId val)
static int call_binTM (lua_State *L, const TObject *p1, const TObject *p2, StkId res, TMS event)
static const TObjectget_compTM (lua_State *L, Table *mt1, Table *mt2, TMS event)
static int call_orderTM (lua_State *L, const TObject *p1, const TObject *p2, TMS event)
static int luaV_strcmp (const TString *ls, const TString *rs)
int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r)
static int luaV_lessequal (lua_State *L, const TObject *l, const TObject *r)
int luaV_equalval (lua_State *L, const TObject *t1, const TObject *t2)
void luaV_concat (lua_State *L, int total, int last)
static void Arith (lua_State *L, StkId ra, const TObject *rb, const TObject *rc, TMS op)
StkId luaV_execute (lua_State *L)


Define Documentation

#define dojump pc,
 )     ((pc) += (i))
 

Definition at line 421 of file lvm.c.

Referenced by luaV_execute().

#define KBx  )     (k+GETARG_Bx(i))
 

Definition at line 418 of file lvm.c.

Referenced by luaV_execute().

#define lua_number2str s,
 )     sprintf((s), LUA_NUMBER_FMT, (n))
 

Definition at line 35 of file lvm.c.

Referenced by luaV_tostring().

#define lvm_c
 

Definition at line 15 of file lvm.c.

#define MAXTAGLOOP   100
 

Definition at line 40 of file lvm.c.

Referenced by luaV_gettable(), and luaV_settable().

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

Definition at line 411 of file lvm.c.

Referenced by luaV_execute().

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

Definition at line 414 of file lvm.c.

Referenced by luaV_execute().

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

Definition at line 416 of file lvm.c.

#define RKB  )     ((GETARG_B(i) < MAXSTACK) ? RB(i) : k+GETARG_B(i)-MAXSTACK)
 

Definition at line 415 of file lvm.c.

Referenced by luaV_execute().

#define RKC  )     ((GETARG_C(i) < MAXSTACK) ? RC(i) : k+GETARG_C(i)-MAXSTACK)
 

Definition at line 417 of file lvm.c.

Referenced by luaV_execute().

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

Definition at line 409 of file lvm.c.

Referenced by luaV_execute().

#define XRA  )     (L->base+GETARG_A(i))
 

Definition at line 413 of file lvm.c.

Referenced by luaV_execute().


Function Documentation

static void Arith lua_State L,
StkId  ra,
const TObject rb,
const TObject rc,
TMS  op
[static]
 

Definition at line 373 of file lvm.c.

References call_binTM(), callTMres(), G, gt, hvalue, lua_assert, luaG_aritherror(), luaG_runerror(), luaH_getstr(), luaV_tonumber(), nvalue, restorestack, savestack, setnvalue, setobjs2s, TM_ADD, TM_DIV, TM_MUL, TM_POW, TM_SUB, and ttisfunction.

Referenced by luaV_execute().

static int call_binTM lua_State L,
const TObject p1,
const TObject p2,
StkId  res,
TMS  event
[static]
 

Definition at line 209 of file lvm.c.

References callTMres(), luaT_gettmbyobj(), restorestack, savestack, setobjs2s, lua_State::top, ttisfunction, and ttisnil.

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

static int call_orderTM lua_State L,
const TObject p1,
const TObject p2,
TMS  event
[static]
 

Definition at line 242 of file lvm.c.

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

Referenced by luaV_lessequal(), and luaV_lessthan().

static void callTM lua_State L,
const TObject f,
const TObject p1,
const TObject p2,
const TObject p3
[static]
 

Definition at line 115 of file lvm.c.

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

Referenced by luaV_settable().

static void callTMres lua_State L,
const TObject f,
const TObject p1,
const TObject p2
[static]
 

Definition at line 100 of file lvm.c.

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

Referenced by Arith(), call_binTM(), call_orderTM(), luaV_equalval(), luaV_getnotable(), and luaV_index().

static const TObject* get_compTM lua_State L,
Table mt1,
Table mt2,
TMS  event
[static]
 

Definition at line 226 of file lvm.c.

References fasttm, and luaO_rawequalObj().

Referenced by luaV_equalval().

void luaV_concat lua_State L,
int  total,
int  last
 

Definition at line 340 of file lvm.c.

References lua_State::base, call_binTM(), cast, G, luaG_concaterror(), luaG_runerror(), luaS_newlstr(), luaZ_openspace(), MAX_SIZET, setsvalue2s, svalue, TM_CONCAT, tostring, and tsvalue.

Referenced by lua_concat(), luaO_pushvfstring(), and luaV_execute().

int luaV_equalval lua_State L,
const TObject t1,
const TObject t2
 

Definition at line 313 of file lvm.c.

References bvalue, callTMres(), gcvalue, get_compTM(), hvalue, l_isfalse, lua_assert, nvalue, pvalue, TM_EQ, lua_State::top, ttype, and uvalue.

StkId luaV_execute lua_State L  ) 
 

Definition at line 424 of file lvm.c.

References Arith(), lua_State::base, CallInfo::base, call_binTM(), chgnvalue, lua_State::ci, CI_C, CI_CALLING, CI_HASFRAME, CI_SAVEDPC, CI_YIELD, clvalue, dojump, equalobj, fb2int, LClosure::g, GET_OPCODE, GETARG_A, GETARG_B, GETARG_Bx, GETARG_C, GETARG_sBx, gt, lua_State::hookcount, lua_State::hookmask, hvalue, Proto::k, KBx, Closure::l, l_isfalse, LFIELDS_PER_FLUSH, lua_assert, luaC_checkGC, luaD_call(), luaD_callhook(), luaD_poscall(), luaD_precall(), luaF_close(), luaF_findupval(), luaF_newLclosure(), luaG_aritherror(), luaG_runerror(), luaH_get(), luaH_getstr(), luaH_new(), luaH_setnum(), luaS_new, luaV_concat(), luaV_getnotable(), luaV_index(), luaV_lessequal(), luaV_lessthan(), luaV_settable(), Proto::nups, nvalue, OP_ADD, OP_CALL, OP_CLOSE, OP_CLOSURE, OP_CONCAT, OP_DIV, OP_EQ, OP_FORLOOP, OP_GETGLOBAL, OP_GETTABLE, OP_GETUPVAL, OP_JMP, OP_LE, OP_LOADBOOL, OP_LOADK, OP_LOADNIL, OP_LT, OP_MOVE, OP_MUL, OP_NEWTABLE, OP_NOT, OP_POW, OP_RETURN, OP_SELF, OP_SETGLOBAL, OP_SETLIST, OP_SETLISTO, OP_SETTABLE, OP_SETUPVAL, OP_SUB, OP_TAILCALL, OP_TEST, OP_TFORLOOP, OP_TFORPREP, OP_UNM, lua_State::openupval, LClosure::p, Proto::p, RA, RB, RKB, RKC, runtime_check, setbvalue, setclvalue, sethvalue, setnilvalue, setnvalue, setobj, setobj2s, setobj2t, setobjs2s, lua_State::stack, lua_State::stacksize, CallInfo::state, TM_ADD, TM_DIV, TM_MUL, TM_POW, TM_SUB, TM_UNM, tonumber, lua_State::top, CallInfo::top, traceexec(), tsvalue, ttisfunction, ttisnil, ttisnumber, ttisstring, ttistable, CallInfo::u, LClosure::upvals, UpVal::v, and XRA.

Referenced by luaD_call(), and resume().

static const TObject* luaV_getnotable lua_State L,
const TObject t,
TObject key,
int  loop
[static]
 

Definition at line 144 of file lvm.c.

References callTMres(), luaG_typeerror(), luaT_gettmbyobj(), luaV_gettable(), TM_INDEX, ttisfunction, and ttisnil.

Referenced by luaV_execute(), and luaV_gettable().

const TObject* luaV_gettable lua_State L,
const TObject t,
TObject key,
int  loop
 

Definition at line 166 of file lvm.c.

References hvalue, luaG_runerror(), luaH_get(), luaV_getnotable(), luaV_index(), MAXTAGLOOP, ttisnil, and ttistable.

Referenced by lua_gettable(), luaV_getnotable(), and luaV_index().

static const TObject* luaV_index lua_State L,
const TObject t,
TObject key,
int  loop
[static]
 

Definition at line 130 of file lvm.c.

References callTMres(), fasttm, hvalue, luaO_nilobject, luaV_gettable(), TM_INDEX, and ttisfunction.

Referenced by luaV_execute(), and luaV_gettable().

static int luaV_lessequal lua_State L,
const TObject l,
const TObject r
[static]
 

Definition at line 295 of file lvm.c.

References call_orderTM(), luaG_ordererror(), luaV_strcmp(), nvalue, TM_LE, TM_LT, tsvalue, ttisnumber, ttisstring, and ttype.

Referenced by luaV_execute().

int luaV_lessthan lua_State L,
const TObject l,
const TObject r
 

Definition at line 281 of file lvm.c.

References call_orderTM(), luaG_ordererror(), luaV_strcmp(), nvalue, TM_LT, tsvalue, ttisnumber, ttisstring, and ttype.

Referenced by lua_lessthan(), and luaV_execute().

void luaV_settable lua_State L,
const TObject t,
TObject key,
StkId  val
 

Definition at line 183 of file lvm.c.

References callTM(), fasttm, hvalue, luaG_runerror(), luaG_typeerror(), luaH_set(), luaT_gettmbyobj(), MAXTAGLOOP, Table::metatable, setobj2t, TM_NEWINDEX, ttisfunction, ttisnil, and ttistable.

Referenced by lua_settable(), and luaV_execute().

static int luaV_strcmp const TString ls,
const TString rs
[static]
 

Definition at line 257 of file lvm.c.

References getstr, and TString::tsv.

Referenced by luaV_lessequal(), and luaV_lessthan().

const TObject* luaV_tonumber const TObject obj,
TObject n
 

Definition at line 43 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 55 of file lvm.c.

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

Referenced by lua_strlen(), and lua_tostring().

static void traceexec lua_State L  )  [static]
 

Definition at line 67 of file lvm.c.

References lua_State::ci, ci_func, CI_HASFRAME, getline, lua_State::hookcount, lua_State::hookinit, lua_State::hookmask, lua_assert, luaD_callhook(), luaG_inithooks(), pcRel, resethookcount, CallInfo::state, and CallInfo::u.

Referenced by luaV_execute().


Generated on Tue Dec 27 22:20:18 2016 for rpm by  doxygen 1.4.4