#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"
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 TObject * | luaV_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 TObject * | luaV_index (lua_State *L, const TObject *t, TObject *key, int loop) |
static const TObject * | luaV_getnotable (lua_State *L, const TObject *t, TObject *key, int loop) |
const TObject * | luaV_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 TObject * | get_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 lua_number2str | ( | s, | |||
n | ) | sprintf((s), LUA_NUMBER_FMT, (n)) |
#define MAXTAGLOOP 100 |
#define RKB | ( | i | ) | ((GETARG_B(i) < MAXSTACK) ? RB(i) : k+GETARG_B(i)-MAXSTACK) |
#define RKC | ( | i | ) | ((GETARG_C(i) < MAXSTACK) ? RC(i) : k+GETARG_C(i)-MAXSTACK) |
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.
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(), and luaV_concat().
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().
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(), and luaO_pushvfstring().
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.
Definition at line 424 of file lvm.c.
References lua_State::base, lua_State::ci, CI_CALLING, CI_HASFRAME, CI_SAVEDPC, CI_YIELD, clvalue, lua_State::hookcount, lua_State::hookmask, Proto::k, CallInfo::l, lua_assert, luaD_callhook(), LClosure::p, CallInfo::state, traceexec(), and CallInfo::u.
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_gettable().
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_gettable().
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.
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().
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().
Definition at line 257 of file lvm.c.
References getstr, TString::len, and TString::tsv.
Referenced by luaV_lessequal(), and luaV_lessthan().
Definition at line 43 of file lvm.c.
References luaO_str2d(), setnvalue, svalue, ttisnumber, and ttisstring.
Referenced by Arith(), and luaG_aritherror().
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, CallInfo::l, lua_assert, luaD_callhook(), luaG_inithooks(), pcRel, resethookcount, CallInfo::state, and CallInfo::u.
Referenced by luaV_execute().