diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-17 12:40:06 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-09-17 12:40:06 -0300 |
commit | 4c6dfc342b026a51bfe3e2d56b1032fb670a2577 (patch) | |
tree | fa73b9a56acbd6b5f75e13e9bc15c0f2a5eef8d4 /ldo.c | |
parent | 686e57cf9c61070ff961407e3304071e171542f4 (diff) | |
download | lua-4c6dfc342b026a51bfe3e2d56b1032fb670a2577.tar.gz lua-4c6dfc342b026a51bfe3e2d56b1032fb670a2577.tar.bz2 lua-4c6dfc342b026a51bfe3e2d56b1032fb670a2577.zip |
CallInfo lists shrinks together with their associated stacks
Diffstat (limited to 'ldo.c')
-rw-r--r-- | ldo.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.109 2013/04/19 21:05:04 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.110 2013/08/27 18:53:35 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 | */ |
@@ -206,7 +206,11 @@ void luaD_shrinkstack (lua_State *L) { | |||
206 | int inuse = stackinuse(L); | 206 | int inuse = stackinuse(L); |
207 | int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; | 207 | int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; |
208 | if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK; | 208 | if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK; |
209 | if (inuse > LUAI_MAXSTACK || /* handling stack overflow? */ | 209 | if (L->stacksize > LUAI_MAXSTACK) /* was handling stack overflow? */ |
210 | luaE_freeCI(L); /* free all CIs (list grew because of an error) */ | ||
211 | else | ||
212 | luaE_shrinkCI(L); /* shrink list */ | ||
213 | if (inuse > LUAI_MAXSTACK || /* still handling stack overflow? */ | ||
210 | goodsize >= L->stacksize) /* would grow instead of shrink? */ | 214 | goodsize >= L->stacksize) /* would grow instead of shrink? */ |
211 | condmovestack(L); /* don't change stack (change only for debugging) */ | 215 | condmovestack(L); /* don't change stack (change only for debugging) */ |
212 | else | 216 | else |