diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-20 16:25:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-12-20 16:25:20 -0300 |
commit | ad0ea7813b39e76b377983138ca995189e22054f (patch) | |
tree | 087e3585a4b4bf5ae65f56b9599bbff9c361a123 /lapi.c | |
parent | 666e95a66d1a2ceb98bdf320980b3f655264a9c9 (diff) | |
download | lua-ad0ea7813b39e76b377983138ca995189e22054f.tar.gz lua-ad0ea7813b39e76b377983138ca995189e22054f.tar.bz2 lua-ad0ea7813b39e76b377983138ca995189e22054f.zip |
GC parameters encoded as floating-point bytes
This encoding brings more precision and a larger range for these
parameters.
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 19 |
1 files changed, 6 insertions, 13 deletions
@@ -1190,12 +1190,9 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
1190 | int minormajor = va_arg(argp, int); | 1190 | int minormajor = va_arg(argp, int); |
1191 | int majorminor = va_arg(argp, int); | 1191 | int majorminor = va_arg(argp, int); |
1192 | res = (g->gckind == KGC_INC) ? LUA_GCINC : LUA_GCGEN; | 1192 | res = (g->gckind == KGC_INC) ? LUA_GCINC : LUA_GCGEN; |
1193 | if (minormul >= 0) | 1193 | setgcparam(g, gcpgenminormul, minormul); |
1194 | setgcparam(g, genminormul, minormul); | 1194 | setgcparam(g, gcpminormajor, minormajor); |
1195 | if (minormajor >= 0) | 1195 | setgcparam(g, gcpmajorminor, majorminor); |
1196 | setgcparam(g, minormajor, minormajor); | ||
1197 | if (majorminor >= 0) | ||
1198 | setgcparam(g, majorminor, majorminor); | ||
1199 | luaC_changemode(L, KGC_GENMINOR); | 1196 | luaC_changemode(L, KGC_GENMINOR); |
1200 | break; | 1197 | break; |
1201 | } | 1198 | } |
@@ -1204,13 +1201,9 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
1204 | int stepmul = va_arg(argp, int); | 1201 | int stepmul = va_arg(argp, int); |
1205 | int stepsize = va_arg(argp, int); | 1202 | int stepsize = va_arg(argp, int); |
1206 | res = (g->gckind == KGC_INC) ? LUA_GCINC : LUA_GCGEN; | 1203 | res = (g->gckind == KGC_INC) ? LUA_GCINC : LUA_GCGEN; |
1207 | if (pause >= 0) | 1204 | setgcparam(g, gcppause, pause); |
1208 | setgcparam(g, gcpause, pause); | 1205 | setgcparam(g, gcpstepmul, stepmul); |
1209 | if (stepmul >= 0) | 1206 | setgcparam(g, gcpstepsize, stepsize); |
1210 | setgcparam(g, gcstepmul, stepmul); | ||
1211 | if (stepsize >= 0) | ||
1212 | g->gcstepsize = (stepsize <= log2maxs(l_obj)) ? stepsize | ||
1213 | : log2maxs(l_obj); | ||
1214 | luaC_changemode(L, KGC_INC); | 1207 | luaC_changemode(L, KGC_INC); |
1215 | break; | 1208 | break; |
1216 | } | 1209 | } |