| 244 | |
| 245 | |
| 246 | void luaD_shrinkstack (lua_State *L) { |
| 247 | int inuse = stackinuse(L); |
| 248 | int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; |
| 249 | if (goodsize > LUAI_MAXSTACK) |
| 250 | goodsize = LUAI_MAXSTACK; /* respect stack limit */ |
| 251 | /* if thread is currently not handling a stack overflow and its |
| 252 | good size is smaller than current size, shrink its stack */ |
| 253 | if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && |
| 254 | goodsize < L->stacksize) |
| 255 | luaD_reallocstack(L, goodsize, 0); /* ok if that fails */ |
| 256 | else /* don't change stack */ |
| 257 | condmovestack(L,{},{}); /* (change only for debugging) */ |
| 258 | luaE_shrinkCI(L); /* shrink CI list */ |
| 259 | } |
| 260 | |
| 261 | |
| 262 | void luaD_inctop (lua_State *L) { |
no test coverage detected