summaryrefslogtreecommitdiff
path: root/src/lstate.h
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2014-07-31 12:00:00 +0000
committerrepogen <>2014-07-31 12:00:00 +0000
commitd7648e85b78d53a2248de909868192598ad0eb69 (patch)
treec67708a14fd29f8ff7e4981aadb041c5ab577e08 /src/lstate.h
parent3907bda05b0e73eba86487ad703e832ca14b64ce (diff)
downloadlua-github-5.3.0-alpha.tar.gz
Lua 5.3.0-alpha5.3.0-alpha
Diffstat (limited to 'src/lstate.h')
-rw-r--r--src/lstate.h66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/lstate.h b/src/lstate.h
index add9e95b..698bea0d 100644
--- a/src/lstate.h
+++ b/src/lstate.h
@@ -1,5 +1,5 @@
/*
-** $Id: lstate.h,v 2.107 2014/06/12 19:07:30 roberto Exp $
+** $Id: lstate.h,v 2.114 2014/07/23 17:15:43 roberto Exp $
** Global State
** See Copyright Notice in lua.h
*/
@@ -60,9 +60,6 @@ typedef struct CallInfo {
StkId func; /* function index in the stack */
StkId top; /* top for this function */
struct CallInfo *previous, *next; /* dynamic call link */
- ptrdiff_t extra;
- short nresults; /* expected number of results from this function */
- lu_byte callstatus;
union {
struct { /* only for Lua functions */
StkId base; /* base for this function */
@@ -71,9 +68,12 @@ typedef struct CallInfo {
struct { /* only for C functions */
lua_KFunction k; /* continuation in case of yields */
ptrdiff_t old_errfunc;
- int ctx; /* context info. in case of yields */
+ lua_Ctx ctx; /* context info. in case of yields */
} c;
} u;
+ ptrdiff_t extra;
+ short nresults; /* expected number of results from this function */
+ lu_byte callstatus;
} CallInfo;
@@ -149,20 +149,20 @@ struct lua_State {
const Instruction *oldpc; /* last pc traced */
StkId stack_last; /* last free slot in the stack */
StkId stack; /* stack base */
- int stacksize;
- unsigned short nny; /* number of non-yieldable calls in stack */
- unsigned short nCcalls; /* number of nested C calls */
- lu_byte hookmask;
- lu_byte allowhook;
- int basehookcount;
- int hookcount;
- lua_Hook hook;
UpVal *openupval; /* list of open upvalues in this stack */
GCObject *gclist;
struct lua_State *twups; /* list of threads with open upvalues */
struct lua_longjmp *errorJmp; /* current error recover point */
- ptrdiff_t errfunc; /* current error handling function (stack index) */
CallInfo base_ci; /* CallInfo for first level (C calling Lua) */
+ 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;
+ lu_byte allowhook;
};
@@ -170,12 +170,12 @@ struct lua_State {
/*
-** Union of all collectable objects
+** Union of all collectable objects (only for conversions)
*/
-union GCObject {
- GCheader gch; /* common header */
- union TString ts;
- union Udata u;
+union GCUnion {
+ GCObject gc; /* common header */
+ struct TString ts;
+ struct Udata u;
union Closure cl;
struct Table h;
struct Proto p;
@@ -183,24 +183,24 @@ union GCObject {
};
-#define gch(o) (&(o)->gch)
+#define cast_u(o) cast(union GCUnion *, (o))
/* macros to convert a GCObject into a specific value */
-#define rawgco2ts(o) \
- check_exp(novariant((o)->gch.tt) == LUA_TSTRING, &((o)->ts))
-#define gco2ts(o) (&rawgco2ts(o)->tsv)
-#define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u))
-#define gco2u(o) (&rawgco2u(o)->uv)
-#define gco2lcl(o) check_exp((o)->gch.tt == LUA_TLCL, &((o)->cl.l))
-#define gco2ccl(o) check_exp((o)->gch.tt == LUA_TCCL, &((o)->cl.c))
+#define gco2ts(o) \
+ check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts))
+#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u))
+#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l))
+#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c))
#define gco2cl(o) \
- check_exp(novariant((o)->gch.tt) == LUA_TFUNCTION, &((o)->cl))
-#define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
-#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
-#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
+ check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl))
+#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h))
+#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p))
+#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th))
+
-/* macro to convert any Lua object into a GCObject */
-#define obj2gco(v) (cast(GCObject *, (v)))
+/* macro to convert a Lua object into a GCObject */
+#define obj2gco(v) \
+ check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc)))
/* actual number of total bytes allocated */