#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lparser.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lundump.h"
#include "lvm.h"
#include "lzio.h"
Go to the source code of this file.
Data Structures | |
struct | lua_longjmp |
struct | SParser |
Defines | |
#define | ldo_c |
#define | LUA_CORE |
#define | inc_ci(L) |
Functions | |
void | luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) |
static void | restore_stack_limit (lua_State *L) |
static void | resetstack (lua_State *L, int status) |
void | luaD_throw (lua_State *L, int errcode) |
int | luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) |
static void | correctstack (lua_State *L, TValue *oldstack) |
void | luaD_reallocstack (lua_State *L, int newsize) |
void | luaD_reallocCI (lua_State *L, int newsize) |
void | luaD_growstack (lua_State *L, int n) |
static CallInfo * | growCI (lua_State *L) |
void | luaD_callhook (lua_State *L, int event, int line) |
static StkId | adjust_varargs (lua_State *L, Proto *p, int actual) |
static StkId | tryfuncTM (lua_State *L, StkId func) |
int | luaD_precall (lua_State *L, StkId func, int nresults) |
static StkId | callrethooks (lua_State *L, StkId firstResult) |
int | luaD_poscall (lua_State *L, StkId firstResult) |
void | luaD_call (lua_State *L, StkId func, int nResults) |
static void | resume (lua_State *L, void *ud) |
static int | resume_error (lua_State *L, const char *msg) |
LUA_API int | lua_resume (lua_State *L, int nargs) |
LUA_API int | lua_yield (lua_State *L, int nresults) |
int | luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef) |
static void | f_parser (lua_State *L, void *ud) |
int | luaD_protectedparser (lua_State *L, ZIO *z, const char *name) |
#define inc_ci | ( | L | ) |
((L->ci == L->end_ci) ? growCI(L) : \ (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci))
Definition at line 259 of file ldo.c.
Referenced by luaD_precall().
Definition at line 208 of file ldo.c.
References cast_num, i, Proto::is_vararg, iswhite, luaC_checkGC, luaH_new(), luaH_setnum(), luaH_setstr(), luaS_newliteral, Proto::numparams, obj2gco, sethvalue, setnilvalue, setnvalue, setobj2n, setobjs2s, lua_State::top, VARARG_HASARG, and VARARG_NEEDSARG.
Referenced by luaD_precall().
Definition at line 331 of file ldo.c.
References lua_State::ci, f_isLua, lua_State::hookmask, LUA_HOOKRET, LUA_HOOKTAILRET, LUA_MASKRET, luaD_callhook(), restorestack, savestack, and CallInfo::tailcalls.
Referenced by luaD_poscall().
Definition at line 126 of file ldo.c.
References lua_State::base, CallInfo::base, lua_State::base_ci, CallInfo::func, GCObject::gch, gco2uv, lua_State::openupval, lua_State::stack, CallInfo::top, and lua_State::top.
Referenced by luaD_reallocstack().
static void f_parser | ( | lua_State * | L, | |
void * | ud | |||
) | [static] |
Definition at line 490 of file ldo.c.
References SParser::buff, cl, gt, hvalue, i, incr_top, Closure::l, LUA_SIGNATURE, luaC_checkGC, luaF_newLclosure(), luaF_newupval(), luaU_undump(), luaY_parser(), luaZ_lookahead(), SParser::name, Proto::nups, LClosure::p, setclvalue, lua_State::top, LClosure::upvals, and SParser::z.
Referenced by luaD_protectedparser().
Definition at line 169 of file ldo.c.
References lua_State::ci, LUA_ERRERR, luaD_reallocCI(), luaD_throw(), luaG_runerror(), LUAI_MAXCALLS, and lua_State::size_ci.
LUA_API int lua_resume | ( | lua_State * | L, | |
int | nargs | |||
) |
Definition at line 417 of file ldo.c.
References lua_State::base_ci, lua_State::baseCcalls, cast_byte, lua_State::ci, lua_State::errfunc, LUA_YIELD, luaD_rawrunprotected(), luaD_seterrorobj(), LUAI_MAXCCALLS, luai_userstateresume, lua_State::nCcalls, resume(), resume_error(), lua_State::status, lua_longjmp::status, CallInfo::top, and lua_State::top.
Referenced by auxresume().
LUA_API int lua_yield | ( | lua_State * | L, | |
int | nresults | |||
) |
Definition at line 443 of file ldo.c.
References lua_State::base, lua_State::baseCcalls, LUA_YIELD, luaG_runerror(), luai_userstateyield, lua_State::nCcalls, lua_State::status, and lua_State::top.
Referenced by luaB_yield().
Definition at line 369 of file ldo.c.
References LUA_ERRERR, luaC_checkGC, luaD_precall(), luaD_throw(), luaG_runerror(), LUAI_MAXCCALLS, luaV_execute(), lua_State::nCcalls, and PCRLUA.
Referenced by callTM(), callTMres(), f_call(), f_Ccall(), GCTM(), lua_call(), luaG_errormsg(), and luaV_execute().
void luaD_callhook | ( | lua_State * | L, | |
int | event, | |||
int | line | |||
) |
Definition at line 181 of file ldo.c.
References lua_State::allowhook, lua_State::base_ci, cast_int, lua_State::ci, lua_Debug::currentline, lua_Debug::event, lua_State::hook, lua_Debug::i_ci, LUA_HOOKTAILRET, LUA_MINSTACK, luaD_checkstack, restorestack, savestack, lua_State::stack_last, CallInfo::top, and lua_State::top.
Referenced by callrethooks(), luaD_precall(), and traceexec().
void luaD_growstack | ( | lua_State * | L, | |
int | n | |||
) |
Definition at line 161 of file ldo.c.
References luaD_reallocstack(), and lua_State::stacksize.
Definition at line 455 of file ldo.c.
References lua_State::allowhook, CallInfo::base, lua_State::base, lua_State::ci, lua_State::errfunc, luaD_rawrunprotected(), luaD_seterrorobj(), luaF_close(), lua_State::nCcalls, restore_stack_limit(), restoreci, restorestack, saveci, CallInfo::savedpc, lua_State::savedpc, and lua_longjmp::status.
Referenced by lua_cpcall(), lua_pcall(), and luaD_protectedparser().
Definition at line 342 of file ldo.c.
References lua_State::base, callrethooks(), lua_State::ci, CallInfo::func, lua_State::hookmask, i, LUA_MASKRET, LUA_MULTRET, CallInfo::nresults, lua_State::savedpc, setnilvalue, setobjs2s, and lua_State::top.
Referenced by luaD_precall(), luaV_execute(), and resume().
Definition at line 264 of file ldo.c.
References adjust_varargs(), CallInfo::base, lua_State::base, cast_int, lua_State::ci, cl, clvalue, Proto::code, curr_func, CallInfo::func, lua_State::hookmask, inc_ci, Proto::is_vararg, LUA_HOOKCALL, LUA_MASKCALL, LUA_MINSTACK, luaD_callhook(), luaD_checkstack, luaD_poscall(), Proto::maxstacksize, CallInfo::nresults, Proto::numparams, LClosure::p, PCRC, PCRLUA, PCRYIELD, restorestack, lua_State::savedpc, CallInfo::savedpc, savestack, setnilvalue, st, lua_State::stack_last, CallInfo::tailcalls, CallInfo::top, lua_State::top, tryfuncTM(), and ttisfunction.
Referenced by luaD_call(), luaV_execute(), and resume().
Definition at line 508 of file ldo.c.
References SParser::buff, lua_State::errfunc, f_parser(), luaD_pcall(), luaZ_freebuffer, luaZ_initbuffer, SParser::name, savestack, lua_State::top, and SParser::z.
Referenced by lua_load().
Definition at line 111 of file ldo.c.
References lua_State::errorJmp, LUAI_TRY, lua_longjmp::previous, and lua_longjmp::status.
Referenced by lua_close(), lua_newstate(), lua_resume(), and luaD_pcall().
void luaD_reallocCI | ( | lua_State * | L, | |
int | newsize | |||
) |
Definition at line 152 of file ldo.c.
References lua_State::base_ci, lua_State::ci, lua_State::end_ci, luaM_reallocvector, and lua_State::size_ci.
Referenced by checkstacksizes(), growCI(), and restore_stack_limit().
void luaD_reallocstack | ( | lua_State * | L, | |
int | newsize | |||
) |
Definition at line 141 of file ldo.c.
References correctstack(), EXTRA_STACK, luaM_reallocvector, lua_State::stack, lua_State::stack_last, and lua_State::stacksize.
Referenced by checkstacksizes(), and luaD_growstack().
Definition at line 51 of file ldo.c.
References LUA_ERRERR, LUA_ERRMEM, LUA_ERRRUN, LUA_ERRSYNTAX, luaS_newliteral, MEMERRMSG, setobjs2s, setsvalue2s, and lua_State::top.
Referenced by lua_resume(), luaD_pcall(), and resetstack().
void luaD_throw | ( | lua_State * | L, | |
int | errcode | |||
) |
Definition at line 94 of file ldo.c.
References cast_byte, lua_State::errorJmp, G, LUAI_THROW, panic(), resetstack(), lua_State::status, and lua_longjmp::status.
Referenced by error(), growCI(), luaD_call(), luaG_errormsg(), luaM_realloc_(), and luaX_lexerror().
static void resetstack | ( | lua_State * | L, | |
int | status | |||
) | [static] |
Definition at line 81 of file ldo.c.
References lua_State::allowhook, CallInfo::base, lua_State::base, lua_State::base_ci, lua_State::baseCcalls, lua_State::ci, lua_State::errfunc, lua_State::errorJmp, luaD_seterrorobj(), luaF_close(), lua_State::nCcalls, and restore_stack_limit().
Referenced by luaD_throw().
static void restore_stack_limit | ( | lua_State * | L | ) | [static] |
Definition at line 71 of file ldo.c.
References lua_State::base_ci, cast_int, lua_State::ci, EXTRA_STACK, luaD_reallocCI(), LUAI_MAXCALLS, lua_State::size_ci, lua_State::stack, lua_State::stack_last, and lua_State::stacksize.
Referenced by luaD_pcall(), and resetstack().
static void resume | ( | lua_State * | L, | |
void * | ud | |||
) | [static] |
Definition at line 383 of file ldo.c.
References CallInfo::base, lua_State::base, lua_State::base_ci, cast_int, lua_State::ci, f_isLua, GET_OPCODE, LUA_MULTRET, LUA_YIELD, luaD_poscall(), luaD_precall(), luaV_execute(), OP_CALL, OP_TAILCALL, PCRLUA, lua_State::status, CallInfo::top, and lua_State::top.
Referenced by lua_resume().
static int resume_error | ( | lua_State * | L, | |
const char * | msg | |||
) | [static] |
Definition at line 408 of file ldo.c.
References CallInfo::base, lua_State::ci, incr_top, LUA_ERRRUN, luaS_new, setsvalue2s, and lua_State::top.
Referenced by lua_resume().
Definition at line 243 of file ldo.c.
References incr_top, luaG_typeerror(), luaT_gettmbyobj(), restorestack, savestack, setobj2s, setobjs2s, TM_CALL, lua_State::top, and ttisfunction.
Referenced by luaD_precall().