diff options
Diffstat (limited to '')
-rw-r--r-- | ldo.c | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -139,6 +139,16 @@ l_noret luaD_throw (lua_State *L, TStatus errcode) { | |||
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | l_noret luaD_throwbaselevel (lua_State *L, TStatus errcode) { | ||
143 | if (L->errorJmp) { | ||
144 | /* unroll error entries up to the first level */ | ||
145 | while (L->errorJmp->previous != NULL) | ||
146 | L->errorJmp = L->errorJmp->previous; | ||
147 | } | ||
148 | luaD_throw(L, errcode); | ||
149 | } | ||
150 | |||
151 | |||
142 | TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | 152 | TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { |
143 | l_uint32 oldnCcalls = L->nCcalls; | 153 | l_uint32 oldnCcalls = L->nCcalls; |
144 | struct lua_longjmp lj; | 154 | struct lua_longjmp lj; |
@@ -164,6 +174,20 @@ TStatus luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { | |||
164 | #define STACKERRSPACE 200 | 174 | #define STACKERRSPACE 200 |
165 | 175 | ||
166 | 176 | ||
177 | /* | ||
178 | ** LUAI_MAXSTACK limits the size of the Lua stack. | ||
179 | ** It must fit into INT_MAX/2. | ||
180 | */ | ||
181 | |||
182 | #if !defined(LUAI_MAXSTACK) | ||
183 | #if 1000000 < (INT_MAX / 2) | ||
184 | #define LUAI_MAXSTACK 1000000 | ||
185 | #else | ||
186 | #define LUAI_MAXSTACK (INT_MAX / 2u) | ||
187 | #endif | ||
188 | #endif | ||
189 | |||
190 | |||
167 | /* maximum stack size that respects size_t */ | 191 | /* maximum stack size that respects size_t */ |
168 | #define MAXSTACK_BYSIZET ((MAX_SIZET / sizeof(StackValue)) - STACKERRSPACE) | 192 | #define MAXSTACK_BYSIZET ((MAX_SIZET / sizeof(StackValue)) - STACKERRSPACE) |
169 | 193 | ||
@@ -513,7 +537,7 @@ l_sinline void genmoveresults (lua_State *L, StkId res, int nres, | |||
513 | ** to 'res'. Handle most typical cases (zero results for commands, | 537 | ** to 'res'. Handle most typical cases (zero results for commands, |
514 | ** one result for expressions, multiple results for tail calls/single | 538 | ** one result for expressions, multiple results for tail calls/single |
515 | ** parameters) separated. The flag CIST_TBC in 'fwanted', if set, | 539 | ** parameters) separated. The flag CIST_TBC in 'fwanted', if set, |
516 | ** forces the swicth to go to the default case. | 540 | ** forces the switch to go to the default case. |
517 | */ | 541 | */ |
518 | l_sinline void moveresults (lua_State *L, StkId res, int nres, | 542 | l_sinline void moveresults (lua_State *L, StkId res, int nres, |
519 | l_uint32 fwanted) { | 543 | l_uint32 fwanted) { |