From f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 23 Nov 2022 17:17:20 -0300 Subject: First version of GC counting objects for control Still needs to review generational mode. --- ltests.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ltests.c') diff --git a/ltests.c b/ltests.c index 1caed04c..57530884 100644 --- a/ltests.c +++ b/ltests.c @@ -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}, -- cgit v1.2.3-55-g6feb