aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-01-30 11:44:42 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-01-30 11:44:42 -0200
commit2c32bff60987d38a60a58d4f0123f3783da60a63 (patch)
treedd97348ac388dd6087c320994bdce6ff18be02e2 /lapi.c
parent264659bd53e92969a1e17d65c0266597cde24b5d (diff)
downloadlua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.gz
lua-2c32bff60987d38a60a58d4f0123f3783da60a63.tar.bz2
lua-2c32bff60987d38a60a58d4f0123f3783da60a63.zip
After a "bad collections", avoid switching back back to generational
After a major bad collection (one that collects too few objects), next collection will be major again. In that case, avoid switching back to generational mode (as it will have to switch again to incremental to do next major collection).
Diffstat (limited to '')
-rw-r--r--lapi.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lapi.c b/lapi.c
index 8ff7bfbd..4026497e 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1141,22 +1141,21 @@ LUA_API int lua_gc (lua_State *L, int what, ...) {
1141 break; 1141 break;
1142 } 1142 }
1143 case LUA_GCGEN: { 1143 case LUA_GCGEN: {
1144 int oldmode = g->gckind;
1145 int minormul = va_arg(argp, int); 1144 int minormul = va_arg(argp, int);
1146 int majormul = va_arg(argp, int); 1145 int majormul = va_arg(argp, int);
1146 res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC;
1147 if (minormul != 0) 1147 if (minormul != 0)
1148 g->genminormul = minormul; 1148 g->genminormul = minormul;
1149 if (majormul != 0) 1149 if (majormul != 0)
1150 setgcparam(g->genmajormul, majormul); 1150 setgcparam(g->genmajormul, majormul);
1151 luaC_changemode(L, KGC_GEN); 1151 luaC_changemode(L, KGC_GEN);
1152 res = (oldmode == KGC_GEN) ? LUA_GCGEN : LUA_GCINC;
1153 break; 1152 break;
1154 } 1153 }
1155 case LUA_GCINC: { 1154 case LUA_GCINC: {
1156 int oldmode = g->gckind;
1157 int pause = va_arg(argp, int); 1155 int pause = va_arg(argp, int);
1158 int stepmul = va_arg(argp, int); 1156 int stepmul = va_arg(argp, int);
1159 int stepsize = va_arg(argp, int); 1157 int stepsize = va_arg(argp, int);
1158 res = isdecGCmodegen(g) ? LUA_GCGEN : LUA_GCINC;
1160 if (pause != 0) 1159 if (pause != 0)
1161 setgcparam(g->gcpause, pause); 1160 setgcparam(g->gcpause, pause);
1162 if (stepmul != 0) 1161 if (stepmul != 0)
@@ -1164,7 +1163,6 @@ LUA_API int lua_gc (lua_State *L, int what, ...) {
1164 if (stepsize != 0) 1163 if (stepsize != 0)
1165 g->gcstepsize = stepsize; 1164 g->gcstepsize = stepsize;
1166 luaC_changemode(L, KGC_INC); 1165 luaC_changemode(L, KGC_INC);
1167 res = (oldmode == KGC_GEN) ? LUA_GCGEN : LUA_GCINC;
1168 break; 1166 break;
1169 } 1167 }
1170 default: res = -1; /* invalid option */ 1168 default: res = -1; /* invalid option */