diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-01 16:38:28 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-01 16:38:28 -0300 |
commit | b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3 (patch) | |
tree | 99d83abfb2da27d30498f87b9e6b159e73d99812 /lapi.c | |
parent | 35a2fed2d1e0b95a1bfab364707e469863517085 (diff) | |
download | lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.tar.gz lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.tar.bz2 lua-b719ff9399cbc4b19b2b8325417fc5fa0ef3d0e3.zip |
Removed parameter in 'collectgarbage("step")'
A call to 'collectgarbage("step")' always performs one GC basic step.
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 18 |
1 files changed, 2 insertions, 16 deletions
@@ -1191,25 +1191,11 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
1191 | break; | 1191 | break; |
1192 | } | 1192 | } |
1193 | case LUA_GCSTEP: { | 1193 | case LUA_GCSTEP: { |
1194 | int todo = va_arg(argp, int); /* work to be done */ | ||
1195 | int didsomething = 0; | ||
1196 | lu_byte oldstp = g->gcstp; | 1194 | lu_byte oldstp = g->gcstp; |
1197 | g->gcstp = 0; /* allow GC to run (other bits must be zero here) */ | 1195 | g->gcstp = 0; /* allow GC to run (other bits must be zero here) */ |
1198 | if (todo == 0) | 1196 | luaC_step(L); /* run one basic step */ |
1199 | todo = 1 << g->gcstepsize; /* standard step size */ | ||
1200 | while (todo >= g->GCdebt) { /* enough to run a step? */ | ||
1201 | todo -= g->GCdebt; /* decrement 'todo' */ | ||
1202 | luaC_step(L); /* run one basic step */ | ||
1203 | didsomething = 1; | ||
1204 | if (g->gckind == KGC_GEN) /* minor collections? */ | ||
1205 | todo = 0; /* doesn't make sense to repeat in this case */ | ||
1206 | else if (g->gcstate == GCSpause) | ||
1207 | break; /* don't run more than one cycle */ | ||
1208 | } | ||
1209 | /* remove remaining 'todo' from total debt */ | ||
1210 | luaE_setdebt(g, g->GCdebt - todo); | ||
1211 | g->gcstp = oldstp; /* restore previous state */ | 1197 | g->gcstp = oldstp; /* restore previous state */ |
1212 | if (didsomething && g->gcstate == GCSpause) /* end of cycle? */ | 1198 | if (g->gcstate == GCSpause) /* end of cycle? */ |
1213 | res = 1; /* signal it */ | 1199 | res = 1; /* signal it */ |
1214 | break; | 1200 | break; |
1215 | } | 1201 | } |