#include <stddef.h>
#include <string.h>
#include "lua.h"
#include "lapi.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "llex.h"
#include "lmem.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include <time.h>
Go to the source code of this file.
Classes | |
struct | LX |
struct | LG |
Macros | |
#define | lstate_c |
#define | LUA_CORE |
#define | LUAI_GCPAUSE 200 /* 200% */ |
#define | LUAI_GCMAJOR 200 /* 200% */ |
#define | LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ |
#define | MEMERRMSG "not enough memory" |
#define | luai_makeseed() cast(unsigned int, time(NULL)) |
#define | fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) |
#define | addbuff(b, p, e) |
Typedefs | |
typedef struct LX | LX |
typedef struct LG | LG |
Functions | |
static unsigned int | makeseed (lua_State *L) |
void | luaE_setdebt (global_State *g, l_mem debt) |
CallInfo * | luaE_extendCI (lua_State *L) |
void | luaE_freeCI (lua_State *L) |
static void | stack_init (lua_State *L1, lua_State *L) |
static void | freestack (lua_State *L) |
static void | init_registry (lua_State *L, global_State *g) |
static void | f_luaopen (lua_State *L, void *ud) |
static void | preinit_state (lua_State *L, global_State *g) |
static void | close_state (lua_State *L) |
LUA_API lua_State * | lua_newthread (lua_State *L) |
void | luaE_freethread (lua_State *L, lua_State *L1) |
LUA_API lua_State * | lua_newstate (lua_Alloc f, void *ud) |
LUA_API void | lua_close (lua_State *L) |
Definition at line 76 of file lstate.cpp.
Referenced by close_state(), and luaE_freethread().
#define lstate_c |
Definition at line 10 of file lstate.cpp.
#define LUA_CORE |
Definition at line 11 of file lstate.cpp.
#define LUAI_GCMAJOR 200 /* 200% */ |
Definition at line 33 of file lstate.cpp.
Referenced by lua_newstate().
#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ |
Definition at line 37 of file lstate.cpp.
Referenced by lua_newstate().
#define LUAI_GCPAUSE 200 /* 200% */ |
Definition at line 29 of file lstate.cpp.
Referenced by lua_newstate().
Definition at line 50 of file lstate.cpp.
Referenced by makeseed().
#define MEMERRMSG "not enough memory" |
Definition at line 41 of file lstate.cpp.
Referenced by f_luaopen().
Definition at line 222 of file lstate.cpp.
References global_State::buff, global_State::frealloc, freestack(), fromstate, G, gettotalbytes, lua_assert, luaC_freeallobjects(), luaF_close(), luai_userstateclose, luaM_freearray, luaZ_freebuffer, lua_State::stack, global_State::ud, and global_State::version.
Referenced by lua_close(), and lua_newstate().
Definition at line 182 of file lstate.cpp.
References G, global_State::gcrunning, init_registry(), lua_version(), luai_userstateopen, luaS_fix, luaS_newliteral, luaS_resize(), luaT_init(), luaX_init(), MEMERRMSG, global_State::memerrmsg, MINSTRTABSIZE, stack_init(), UNUSED, and global_State::version.
Referenced by lua_newstate().
Definition at line 152 of file lstate.cpp.
References lua_State::base_ci, lua_State::ci, luaE_freeCI(), luaM_freearray, lua_State::stack, and lua_State::stacksize.
Referenced by close_state(), and luaE_freethread().
|
static |
Definition at line 164 of file lstate.cpp.
References global_State::l_registry, LUA_RIDX_GLOBALS, LUA_RIDX_LAST, LUA_RIDX_MAINTHREAD, luaH_new(), luaH_resize(), luaH_setint(), sethvalue, and setthvalue.
Referenced by f_luaopen().
Definition at line 316 of file lstate.cpp.
References close_state(), G, and lua_lock.
Referenced by main(), os_exit(), and lua_kernel_base::~lua_kernel_base().
Definition at line 265 of file lstate.cpp.
References global_State::allgc, global_State::allweak, bit2mask, global_State::buff, cast, close_state(), global_State::currentwhite, global_State::ephemeron, f_luaopen(), global_State::finobj, FIXEDBIT, global_State::frealloc, LG::g, g, global_State::GCdebt, global_State::GCestimate, global_State::gckind, global_State::gcmajorinc, global_State::gcpause, global_State::gcrunning, GCSpause, global_State::gcstate, global_State::gcstepmul, global_State::gray, global_State::grayagain, stringtable::hash, i, if(), KGC_NORMAL, LX::l, LG::l, UpVal::l, global_State::l_registry, LUA_NUMTAGS, LUA_OK, LUA_TTHREAD, luaC_white, luaD_rawrunprotected(), LUAI_GCMAJOR, LUAI_GCMUL, LUAI_GCPAUSE, luaZ_initbuffer, global_State::mainthread, makeseed(), global_State::mt, stringtable::nuse, global_State::panic, preinit_state(), global_State::seed, setnilvalue, stringtable::size, global_State::strt, global_State::sweepfin, global_State::sweepgc, global_State::tobefnz, global_State::totalbytes, UpVal::u, global_State::ud, global_State::uvhead, global_State::version, global_State::weak, and WHITE0BIT.
Referenced by luaL_newstate(), and makeseed().
Definition at line 236 of file lstate.cpp.
References api_incr_top, lua_State::basehookcount, G, lua_State::hook, lua_State::hookmask, lua_lock, LUA_TTHREAD, lua_unlock, luaC_checkGC, luaC_newobj(), luai_userstatethread, preinit_state(), resethookcount, setthvalue, stack_init(), GCObject::th, and lua_State::top.
Referenced by get_new_thread(), and luaB_cocreate().
Definition at line 111 of file lstate.cpp.
References lua_State::ci, lua_assert, luaM_new, CallInfo::next, and CallInfo::previous.
Definition at line 121 of file lstate.cpp.
References lua_State::ci, luaM_free, next, and CallInfo::next.
Referenced by freestack(), and sweepthread().
Definition at line 255 of file lstate.cpp.
References freestack(), fromstate, lua_assert, luaF_close(), luai_userstatefree, luaM_free, lua_State::openupval, and lua_State::stack.
Referenced by freeobj().
void luaE_setdebt | ( | global_State * | g, |
l_mem | debt | ||
) |
Definition at line 105 of file lstate.cpp.
References global_State::GCdebt, and global_State::totalbytes.
Referenced by incstep(), lua_gc(), luaC_step(), and setpause().
Definition at line 88 of file lstate.cpp.
References addbuff, lua_assert, lua_newstate(), luai_makeseed, luaO_nilobject, and luaS_hash().
Referenced by lua_newstate().
|
static |
Definition at line 203 of file lstate.cpp.
References lua_State::allowhook, lua_State::basehookcount, lua_State::ci, lua_State::errfunc, lua_State::errorJmp, G, g, lua_State::hook, lua_State::hookmask, LUA_OK, lua_State::nCcalls, lua_State::nny, lua_State::openupval, resethookcount, lua_State::stack, lua_State::stacksize, and lua_State::status.
Referenced by lua_newstate(), and lua_newthread().
Definition at line 132 of file lstate.cpp.
References lua_State::base_ci, BASIC_STACK_SIZE, CallInfo::callstatus, lua_State::ci, EXTRA_STACK, CallInfo::func, i, LUA_MINSTACK, luaM_newvector, CallInfo::next, CallInfo::previous, setnilvalue, lua_State::stack, lua_State::stack_last, lua_State::stacksize, CallInfo::top, and lua_State::top.
Referenced by f_luaopen(), and lua_newthread().