summaryrefslogtreecommitdiff
path: root/libs/liblua/src/lstate.h
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
committerAlexander Lantsev <aunsane@gmail.com>2016-06-13 14:18:51 +0000
commit8cf571c5ea48be2d281d2c83ed0f2dba6f2c32f4 (patch)
tree0345c47dc55eee01884f535fb26e0a2d44732213 /libs/liblua/src/lstate.h
parent4386b8b61c08045c5d416b546517e1c71c7dcae6 (diff)
lublua:
- updated to 5.3.3 - renamed to lua53.dll git-svn-id: http://svn.miranda-ng.org/main/trunk@16965 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'libs/liblua/src/lstate.h')
-rw-r--r--libs/liblua/src/lstate.h27
1 files changed, 19 insertions, 8 deletions
diff --git a/libs/liblua/src/lstate.h b/libs/liblua/src/lstate.h
index 81e12c40db..b3033bee55 100644
--- a/libs/liblua/src/lstate.h
+++ b/libs/liblua/src/lstate.h
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.h,v 2.119 2014/10/30 18:53:28 roberto Exp $
+** $Id: lstate.h,v 2.130 2015/12/16 16:39:38 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
@@ -33,6 +33,15 @@
struct lua_longjmp; /* defined in ldo.c */
+/*
+** Atomic type (relative to signals) to better ensure that 'lua_sethook'
+** is thread safe
+*/
+#if !defined(l_signalT)
+#include <signal.h>
+#define l_signalT sig_atomic_t
+#endif
+
/* extra stack space to handle TM calls and some other extras */
#define EXTRA_STACK 5
@@ -89,11 +98,12 @@ typedef struct CallInfo {
#define CIST_OAH (1<<0) /* original value of 'allowhook' */
#define CIST_LUA (1<<1) /* call is running a Lua function */
#define CIST_HOOKED (1<<2) /* call is running a debug hook */
-#define CIST_REENTRY (1<<3) /* call is running on same invocation of
- luaV_execute of previous call */
+#define CIST_FRESH (1<<3) /* call is running on a fresh invocation
+ of luaV_execute */
#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */
#define CIST_TAIL (1<<5) /* call was tail called */
#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */
+#define CIST_LEQ (1<<7) /* using __lt for __le */
#define isLua(ci) ((ci)->callstatus & CIST_LUA)
@@ -108,7 +118,7 @@ typedef struct CallInfo {
typedef struct global_State {
lua_Alloc frealloc; /* function to reallocate memory */
void *ud; /* auxiliary data to 'frealloc' */
- lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */
+ l_mem totalbytes; /* number of bytes currently allocated - GCdebt */
l_mem GCdebt; /* bytes allocated not yet compensated by the collector */
lu_mem GCmemtrav; /* memory traversed by the GC */
lu_mem GCestimate; /* an estimate of the non-garbage memory in use */
@@ -130,7 +140,6 @@ typedef struct global_State {
GCObject *tobefnz; /* list of userdata to be GC */
GCObject *fixedgc; /* list of objects not to be collected */
struct lua_State *twups; /* list of threads with open upvalues */
- Mbuffer buff; /* temporary buffer for string concatenation */
unsigned int gcfinnum; /* number of finalizers to call in each GC step */
int gcpause; /* size of pause between successive GCs */
int gcstepmul; /* GC 'granularity' */
@@ -140,6 +149,7 @@ typedef struct global_State {
TString *memerrmsg; /* memory-error message */
TString *tmname[TM_N]; /* array with tag-method names */
struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */
+ TString *strcache[STRCACHE_N][STRCACHE_M]; /* cache for strings in API */
} global_State;
@@ -148,6 +158,7 @@ typedef struct global_State {
*/
struct lua_State {
CommonHeader;
+ unsigned short nci; /* number of items in 'ci' list */
lu_byte status;
StkId top; /* first free slot in the stack */
global_State *l_G;
@@ -160,14 +171,14 @@ struct lua_State {
struct lua_State *twups; /* list of threads with open upvalues */
struct lua_longjmp *errorJmp; /* current error recover point */
CallInfo base_ci; /* CallInfo for first level (C calling Lua) */
- lua_Hook hook;
+ volatile lua_Hook hook;
ptrdiff_t errfunc; /* current error handling function (stack index) */
int stacksize;
int basehookcount;
int hookcount;
unsigned short nny; /* number of non-yieldable calls in stack */
unsigned short nCcalls; /* number of nested C calls */
- lu_byte hookmask;
+ l_signalT hookmask;
lu_byte allowhook;
};
@@ -210,7 +221,7 @@ union GCUnion {
/* actual number of total bytes allocated */
-#define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt)
+#define gettotalbytes(g) cast(lu_mem, (g)->totalbytes + (g)->GCdebt)
LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt);
LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1);