diff options
Diffstat (limited to 'ldo.h')
-rw-r--r-- | ldo.h | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -23,10 +23,19 @@ | |||
23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation | 23 | ** 'condmovestack' is used in heavy tests to force a stack reallocation |
24 | ** at every check. | 24 | ** at every check. |
25 | */ | 25 | */ |
26 | |||
27 | #if !defined(HARDSTACKTESTS) | ||
28 | #define condmovestack(L,pre,pos) ((void)0) | ||
29 | #else | ||
30 | /* realloc stack keeping its size */ | ||
31 | #define condmovestack(L,pre,pos) \ | ||
32 | { int sz_ = stacksize(L); pre; luaD_reallocstack((L), sz_, 0); pos; } | ||
33 | #endif | ||
34 | |||
26 | #define luaD_checkstackaux(L,n,pre,pos) \ | 35 | #define luaD_checkstackaux(L,n,pre,pos) \ |
27 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ | 36 | if (l_unlikely(L->stack_last.p - L->top.p <= (n))) \ |
28 | { pre; luaD_growstack(L, n, 1); pos; } \ | 37 | { pre; luaD_growstack(L, n, 1); pos; } \ |
29 | else { condmovestack(L,pre,pos); } | 38 | else { condmovestack(L,pre,pos); } |
30 | 39 | ||
31 | /* In general, 'pre'/'pos' are empty (nothing to save) */ | 40 | /* In general, 'pre'/'pos' are empty (nothing to save) */ |
32 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) | 41 | #define luaD_checkstack(L,n) luaD_checkstackaux(L,n,(void)0,(void)0) |
@@ -44,6 +53,16 @@ | |||
44 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ | 53 | p = restorestack(L, t__)) /* 'pos' part: restore 'p' */ |
45 | 54 | ||
46 | 55 | ||
56 | /* | ||
57 | ** Maximum depth for nested C calls, syntactical nested non-terminals, | ||
58 | ** and other features implemented through recursion in C. (Value must | ||
59 | ** fit in a 16-bit unsigned integer. It must also be compatible with | ||
60 | ** the size of the C stack.) | ||
61 | */ | ||
62 | #if !defined(LUAI_MAXCCALLS) | ||
63 | #define LUAI_MAXCCALLS 200 | ||
64 | #endif | ||
65 | |||
47 | 66 | ||
48 | /* type of protected functions, to be ran by 'runprotected' */ | 67 | /* type of protected functions, to be ran by 'runprotected' */ |
49 | typedef void (*Pfunc) (lua_State *L, void *ud); | 68 | typedef void (*Pfunc) (lua_State *L, void *ud); |