diff options
Diffstat (limited to '')
-rw-r--r-- | src/lj_state.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lj_state.h b/src/lj_state.h new file mode 100644 index 00000000..54e85405 --- /dev/null +++ b/src/lj_state.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | ** State and stack handling. | ||
3 | ** Copyright (C) 2005-2009 Mike Pall. See Copyright Notice in luajit.h | ||
4 | */ | ||
5 | |||
6 | #ifndef _LJ_STATE_H | ||
7 | #define _LJ_STATE_H | ||
8 | |||
9 | #include "lj_obj.h" | ||
10 | |||
11 | #define incr_top(L) \ | ||
12 | (++L->top >= L->maxstack && (lj_state_growstack1(L), 0)) | ||
13 | |||
14 | #define savestack(L, p) ((char *)(p) - (char *)L->stack) | ||
15 | #define restorestack(L, n) ((TValue *)((char *)L->stack + (n))) | ||
16 | |||
17 | LJ_FUNC void lj_state_relimitstack(lua_State *L); | ||
18 | LJ_FUNC void lj_state_shrinkstack(lua_State *L, MSize used); | ||
19 | LJ_FUNCA void lj_state_growstack(lua_State *L, MSize need); | ||
20 | LJ_FUNCA void lj_state_growstack1(lua_State *L); | ||
21 | |||
22 | static LJ_AINLINE void lj_state_checkstack(lua_State *L, MSize need) | ||
23 | { | ||
24 | if ((MSize)((char *)L->maxstack-(char *)L->top) <= need*(MSize)sizeof(TValue)) | ||
25 | lj_state_growstack(L, need); | ||
26 | } | ||
27 | |||
28 | LJ_FUNC lua_State *lj_state_new(lua_State *L); | ||
29 | LJ_FUNC void LJ_FASTCALL lj_state_free(global_State *g, lua_State *L); | ||
30 | |||
31 | #endif | ||