First version of GC counting objects for control

Still needs to review generational mode.
This commit is contained in:
Roberto Ierusalimschy
2022-11-23 17:17:20 -03:00
parent 76953316d1
commit f356d5acdd
9 changed files with 162 additions and 156 deletions

View File

@@ -1027,6 +1027,16 @@ static int table_query (lua_State *L) {
}
static int query_inc (lua_State *L) {
global_State *g = G(L);
lua_pushinteger(L, gettotalobjs(g));
lua_pushinteger(L, g->GCdebt);
lua_pushinteger(L, getgcparam(g->gcpause));
lua_pushinteger(L, getgcparam(g->gcstepmul));
lua_pushinteger(L, cast(l_mem, 1) << g->gcstepsize);
return 5;
}
static int string_query (lua_State *L) {
stringtable *tb = &G(L)->strt;
int s = cast_int(luaL_optinteger(L, 1, 0)) - 1;
@@ -1933,6 +1943,7 @@ static const struct luaL_Reg tests_funcs[] = {
{"pushuserdata", pushuserdata},
{"querystr", string_query},
{"querytab", table_query},
{"queryinc", query_inc},
{"ref", tref},
{"resume", coresume},
{"s2d", s2d},