diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/LuaJIT-1.1.7/src/lstate.h | 179 |
1 files changed, 0 insertions, 179 deletions
diff --git a/libraries/LuaJIT-1.1.7/src/lstate.h b/libraries/LuaJIT-1.1.7/src/lstate.h deleted file mode 100644 index ddaa554..0000000 --- a/libraries/LuaJIT-1.1.7/src/lstate.h +++ /dev/null | |||
@@ -1,179 +0,0 @@ | |||
1 | /* | ||
2 | ** $Id: lstate.h,v 2.24.1.2 2008/01/03 15:20:39 roberto Exp $ | ||
3 | ** Global State | ||
4 | ** See Copyright Notice in lua.h | ||
5 | */ | ||
6 | |||
7 | #ifndef lstate_h | ||
8 | #define lstate_h | ||
9 | |||
10 | #include "lua.h" | ||
11 | |||
12 | #include "lobject.h" | ||
13 | #include "ltm.h" | ||
14 | #include "lzio.h" | ||
15 | #ifndef COCO_DISABLE | ||
16 | #include "lcoco.h" | ||
17 | #endif | ||
18 | |||
19 | |||
20 | |||
21 | struct lua_longjmp; /* defined in ldo.c */ | ||
22 | struct jit_State; /* defined in ljit.c */ | ||
23 | typedef int (*luaJIT_GateLJ)(lua_State *L, StkId func, int nresults); | ||
24 | |||
25 | |||
26 | /* table of globals */ | ||
27 | #define gt(L) (&L->l_gt) | ||
28 | |||
29 | /* registry */ | ||
30 | #define registry(L) (&G(L)->l_registry) | ||
31 | |||
32 | |||
33 | /* extra stack space to handle TM calls and some other extras */ | ||
34 | /* LuaJIT uses more than the default (5) to speed up calls (setnil loop) */ | ||
35 | #define EXTRA_STACK 8 | ||
36 | |||
37 | |||
38 | #define BASIC_CI_SIZE 8 | ||
39 | |||
40 | #define BASIC_STACK_SIZE (2*LUA_MINSTACK) | ||
41 | |||
42 | |||
43 | |||
44 | typedef struct stringtable { | ||
45 | GCObject **hash; | ||
46 | lu_int32 nuse; /* number of elements */ | ||
47 | int size; | ||
48 | } stringtable; | ||
49 | |||
50 | |||
51 | /* | ||
52 | ** informations about a call | ||
53 | */ | ||
54 | typedef struct CallInfo { | ||
55 | StkId base; /* base for this function */ | ||
56 | StkId func; /* function index in the stack */ | ||
57 | StkId top; /* top for this function */ | ||
58 | const Instruction *savedpc; | ||
59 | int nresults; /* expected number of results from this function */ | ||
60 | int tailcalls; /* number of tail calls lost under this entry */ | ||
61 | } CallInfo; | ||
62 | |||
63 | |||
64 | |||
65 | #define curr_func(L) (clvalue(L->ci->func)) | ||
66 | #define ci_func(ci) (clvalue((ci)->func)) | ||
67 | #define f_isLua(ci) (!ci_func(ci)->c.isC) | ||
68 | #define isLua(ci) (ttisfunction((ci)->func) && f_isLua(ci)) | ||
69 | |||
70 | |||
71 | /* | ||
72 | ** `global state', shared by all threads of this state | ||
73 | */ | ||
74 | typedef struct global_State { | ||
75 | stringtable strt; /* hash table for strings */ | ||
76 | lua_Alloc frealloc; /* function to reallocate memory */ | ||
77 | void *ud; /* auxiliary data to `frealloc' */ | ||
78 | lu_byte currentwhite; | ||
79 | lu_byte gcstate; /* state of garbage collector */ | ||
80 | int sweepstrgc; /* position of sweep in `strt' */ | ||
81 | GCObject *rootgc; /* list of all collectable objects */ | ||
82 | GCObject **sweepgc; /* position of sweep in `rootgc' */ | ||
83 | GCObject *gray; /* list of gray objects */ | ||
84 | GCObject *grayagain; /* list of objects to be traversed atomically */ | ||
85 | GCObject *weak; /* list of weak tables (to be cleared) */ | ||
86 | GCObject *tmudata; /* last element of list of userdata to be GC */ | ||
87 | Mbuffer buff; /* temporary buffer for string concatentation */ | ||
88 | lu_mem GCthreshold; | ||
89 | lu_mem totalbytes; /* number of bytes currently allocated */ | ||
90 | lu_mem estimate; /* an estimate of number of bytes actually in use */ | ||
91 | lu_mem gcdept; /* how much GC is `behind schedule' */ | ||
92 | int gcpause; /* size of pause between successive GCs */ | ||
93 | int gcstepmul; /* GC `granularity' */ | ||
94 | lua_CFunction panic; /* to be called in unprotected errors */ | ||
95 | TValue l_registry; | ||
96 | struct lua_State *mainthread; | ||
97 | UpVal uvhead; /* head of double-linked list of all open upvalues */ | ||
98 | struct Table *mt[NUM_TAGS]; /* metatables for basic types */ | ||
99 | TString *tmname[TM_N]; /* array with tag-method names */ | ||
100 | /* LuaJIT extensions */ | ||
101 | struct jit_State *jit_state; /* JIT state */ | ||
102 | luaJIT_GateLJ jit_gateLJ; /* Lua -> JIT gate */ | ||
103 | lua_CFunction jit_gateJL; /* JIT -> Lua callgate */ | ||
104 | lua_CFunction jit_gateJC; /* JIT -> C callgate */ | ||
105 | } global_State; | ||
106 | |||
107 | |||
108 | /* | ||
109 | ** `per thread' state | ||
110 | */ | ||
111 | struct lua_State { | ||
112 | CommonHeader; | ||
113 | lu_byte status; | ||
114 | StkId top; /* first free slot in the stack */ | ||
115 | StkId base; /* base of current function */ | ||
116 | global_State *l_G; | ||
117 | CallInfo *ci; /* call info for current function */ | ||
118 | const Instruction *savedpc; /* `savedpc' of current function */ | ||
119 | StkId stack_last; /* last free slot in the stack */ | ||
120 | StkId stack; /* stack base */ | ||
121 | CallInfo *end_ci; /* points after end of ci array*/ | ||
122 | CallInfo *base_ci; /* array of CallInfo's */ | ||
123 | int stacksize; | ||
124 | int size_ci; /* size of array `base_ci' */ | ||
125 | unsigned short nCcalls; /* number of nested C calls */ | ||
126 | lu_byte hookmask; | ||
127 | lu_byte allowhook; | ||
128 | int basehookcount; | ||
129 | int hookcount; | ||
130 | lua_Hook hook; | ||
131 | TValue l_gt; /* table of globals */ | ||
132 | TValue env; /* temporary place for environments */ | ||
133 | GCObject *openupval; /* list of open upvalues in this stack */ | ||
134 | GCObject *gclist; | ||
135 | struct lua_longjmp *errorJmp; /* current error recover point */ | ||
136 | ptrdiff_t errfunc; /* current error handling function (stack index) */ | ||
137 | }; | ||
138 | |||
139 | |||
140 | #define G(L) (L->l_G) | ||
141 | |||
142 | |||
143 | /* | ||
144 | ** Union of all collectable objects | ||
145 | */ | ||
146 | union GCObject { | ||
147 | GCheader gch; | ||
148 | union TString ts; | ||
149 | union Udata u; | ||
150 | union Closure cl; | ||
151 | struct Table h; | ||
152 | struct Proto p; | ||
153 | struct UpVal uv; | ||
154 | struct lua_State th; /* thread */ | ||
155 | }; | ||
156 | |||
157 | |||
158 | /* macros to convert a GCObject into a specific value */ | ||
159 | #define rawgco2ts(o) check_exp((o)->gch.tt == LUA_TSTRING, &((o)->ts)) | ||
160 | #define gco2ts(o) (&rawgco2ts(o)->tsv) | ||
161 | #define rawgco2u(o) check_exp((o)->gch.tt == LUA_TUSERDATA, &((o)->u)) | ||
162 | #define gco2u(o) (&rawgco2u(o)->uv) | ||
163 | #define gco2cl(o) check_exp((o)->gch.tt == LUA_TFUNCTION, &((o)->cl)) | ||
164 | #define gco2h(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) | ||
165 | #define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) | ||
166 | #define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | ||
167 | #define ngcotouv(o) \ | ||
168 | check_exp((o) == NULL || (o)->gch.tt == LUA_TUPVAL, &((o)->uv)) | ||
169 | #define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) | ||
170 | |||
171 | /* macro to convert any Lua object into a GCObject */ | ||
172 | #define obj2gco(v) (cast(GCObject *, (v))) | ||
173 | |||
174 | |||
175 | LUAI_FUNC lua_State *luaE_newthread (lua_State *L); | ||
176 | LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); | ||
177 | |||
178 | #endif | ||
179 | |||