aboutsummaryrefslogtreecommitdiff
path: root/ldo.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-12 09:57:30 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-12 09:57:30 -0200
commit725c15a4caec1e40ea475c70224473b23a2d8a51 (patch)
treed73cecc65cf4ec838b059d0c1f99e6e53334455f /ldo.c
parentb077b20206bf90a4d5cb683d8c63595f2af48756 (diff)
downloadlua-725c15a4caec1e40ea475c70224473b23a2d8a51.tar.gz
lua-725c15a4caec1e40ea475c70224473b23a2d8a51.tar.bz2
lua-725c15a4caec1e40ea475c70224473b23a2d8a51.zip
when shrinking stack, always shrinks the CI list.
(Stack overflow is not corelated to CI overflow anymore.)
Diffstat (limited to 'ldo.c')
-rw-r--r--ldo.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/ldo.c b/ldo.c
index a4a2ecbf..c06d7133 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.178 2017/12/08 17:28:25 roberto Exp roberto $ 2** $Id: ldo.c,v 2.179 2017/12/11 12:43:40 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -243,10 +243,6 @@ void luaD_shrinkstack (lua_State *L) {
243 int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; 243 int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK;
244 if (goodsize > LUAI_MAXSTACK) 244 if (goodsize > LUAI_MAXSTACK)
245 goodsize = LUAI_MAXSTACK; /* respect stack limit */ 245 goodsize = LUAI_MAXSTACK; /* respect stack limit */
246 if (L->stacksize > LUAI_MAXSTACK) /* had been handling stack overflow? */
247 luaE_freeCI(L); /* free all CIs (list grew because of an error) */
248 else
249 luaE_shrinkCI(L); /* shrink list */
250 /* if thread is currently not handling a stack overflow and its 246 /* if thread is currently not handling a stack overflow and its
251 good size is smaller than current size, shrink its stack */ 247 good size is smaller than current size, shrink its stack */
252 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) && 248 if (inuse <= (LUAI_MAXSTACK - EXTRA_STACK) &&
@@ -254,6 +250,7 @@ void luaD_shrinkstack (lua_State *L) {
254 luaD_reallocstack(L, goodsize, 0); /* ok if that fails */ 250 luaD_reallocstack(L, goodsize, 0); /* ok if that fails */
255 else /* don't change stack */ 251 else /* don't change stack */
256 condmovestack(L,{},{}); /* (change only for debugging) */ 252 condmovestack(L,{},{}); /* (change only for debugging) */
253 luaE_shrinkCI(L); /* shrink CI list */
257} 254}
258 255
259 256