#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"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 TValue * | luaV_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 TValue * | get_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 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)); \
}
| #define dojump | ( | L, | |||
| pc, | |||||
| i | ) | {(pc) += (i); luai_threadyield(L);} |
| #define KBx | ( | i | ) | check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i)) |
| #define MAXTAGLOOP 100 |
| #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 | ) |
| static void Arith | ( | lua_State * | L, | |
| StkId | ra, | |||
| const TValue * | rb, | |||
| const TValue * | rc, | |||
| TMS | op | |||
| ) | [static] |
Definition at line 316 of file lvm.cpp.
References call_binTM(), lua_assert, luaG_aritherror(), luaV_tonumber(), NULL, nvalue, setnvalue, TM_ADD, TM_DIV, TM_MOD, TM_MUL, TM_POW, TM_SUB, and TM_UNM.
| static int call_binTM | ( | lua_State * | L, | |
| const TValue * | p1, | |||
| const TValue * | p2, | |||
| StkId | res, | |||
| TMS | event | |||
| ) | [static] |
Definition at line 163 of file lvm.cpp.
References callTMres(), luaT_gettmbyobj(), and ttisnil.
Referenced by Arith(), and luaV_concat().
Definition at line 188 of file lvm.cpp.
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 98 of file lvm.cpp.
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] |
Definition at line 82 of file lvm.cpp.
References luaD_call(), luaD_checkstack, restorestack, savestack, setobj2s, setobjs2s, and lua_State::top.
Referenced by call_binTM(), call_orderTM(), luaV_equalval(), and luaV_gettable().
Definition at line 174 of file lvm.cpp.
References fasttm, luaO_rawequalObj(), and NULL.
Referenced by luaV_equalval().
Definition at line 201 of file lvm.cpp.
References getstr, TString::len, LangStringUtil::strlen(), and TString::tsv.
Referenced by lessequal(), and luaV_lessthan().
Definition at line 237 of file lvm.cpp.
References call_orderTM(), l_strcmp(), luaG_ordererror(), nvalue, rawtsvalue, TM_LE, TM_LT, ttisnumber, ttisstring, and ttype.
| void luaV_concat | ( | lua_State * | L, | |
| int | total, | |||
| int | last | |||
| ) |
| void luaV_execute | ( | lua_State * | L, | |
| int | nexeccalls | |||
| ) |
| static void traceexec | ( | lua_State * | L, | |
| const Instruction * | pc | |||
| ) | [static] |
Definition at line 60 of file lvm.cpp.
References lua_State::ci, ci_func, getline, lua_State::hookcount, lua_State::hookmask, LUA_HOOKCOUNT, LUA_HOOKLINE, LUA_MASKLINE, luaD_callhook(), pcRel, resethookcount, and lua_State::savedpc.
1.5.3