diff options
Diffstat (limited to 'lstate.h')
| -rw-r--r-- | lstate.h | 20 |
1 files changed, 18 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstate.h,v 2.159 2018/06/15 19:31:22 roberto Exp roberto $ | 2 | ** $Id: lstate.h $ |
| 3 | ** Global State | 3 | ** Global State |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -49,6 +49,22 @@ | |||
| 49 | */ | 49 | */ |
| 50 | 50 | ||
| 51 | 51 | ||
| 52 | /* | ||
| 53 | |||
| 54 | ** About 'nCcalls': each thread in Lua (a lua_State) keeps a count of | ||
| 55 | ** how many "C calls" it has in the C stack, to avoid C-stack overflow. | ||
| 56 | ** This count is very rough approximation; it considers only recursive | ||
| 57 | ** functions inside the interpreter, as non-recursive calls can be | ||
| 58 | ** considered using a fixed (although unknown) amount of stack space. | ||
| 59 | ** | ||
| 60 | ** The proper count also includes the number of CallInfo structures | ||
| 61 | ** allocated by Lua, as a kind of "potential" calls. So, when Lua | ||
| 62 | ** calls a function (and "consumes" one CallInfo), it needs neither to | ||
| 63 | ** increment nor to check 'nCcalls', as its use of C stack is already | ||
| 64 | ** accounted for. | ||
| 65 | |||
| 66 | */ | ||
| 67 | |||
| 52 | struct lua_longjmp; /* defined in ldo.c */ | 68 | struct lua_longjmp; /* defined in ldo.c */ |
| 53 | 69 | ||
| 54 | 70 | ||
| @@ -212,7 +228,7 @@ struct lua_State { | |||
| 212 | int basehookcount; | 228 | int basehookcount; |
| 213 | int hookcount; | 229 | int hookcount; |
| 214 | unsigned short nny; /* number of non-yieldable calls in stack */ | 230 | unsigned short nny; /* number of non-yieldable calls in stack */ |
| 215 | unsigned short nCcalls; /* number of nested C calls */ | 231 | unsigned short nCcalls; /* number of nested C calls + 'nny' */ |
| 216 | l_signalT hookmask; | 232 | l_signalT hookmask; |
| 217 | lu_byte allowhook; | 233 | lu_byte allowhook; |
| 218 | }; | 234 | }; |
