diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 17:17:20 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2022-11-23 17:17:20 -0300 |
commit | f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4 (patch) | |
tree | baa2abdc9bd4707b42c0609da42aa1130757273b /ltests.c | |
parent | 76953316d1283ab6324b59b914ef53a521408444 (diff) | |
download | lua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.tar.gz lua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.tar.bz2 lua-f356d5acdd9d8e8f7e9d1d7632c4657f945ff4f4.zip |
First version of GC counting objects for control
Still needs to review generational mode.
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -1027,6 +1027,16 @@ static int table_query (lua_State *L) { | |||
1027 | } | 1027 | } |
1028 | 1028 | ||
1029 | 1029 | ||
1030 | static int query_inc (lua_State *L) { | ||
1031 | global_State *g = G(L); | ||
1032 | lua_pushinteger(L, gettotalobjs(g)); | ||
1033 | lua_pushinteger(L, g->GCdebt); | ||
1034 | lua_pushinteger(L, getgcparam(g->gcpause)); | ||
1035 | lua_pushinteger(L, getgcparam(g->gcstepmul)); | ||
1036 | lua_pushinteger(L, cast(l_mem, 1) << g->gcstepsize); | ||
1037 | return 5; | ||
1038 | } | ||
1039 | |||
1030 | static int string_query (lua_State *L) { | 1040 | static int string_query (lua_State *L) { |
1031 | stringtable *tb = &G(L)->strt; | 1041 | stringtable *tb = &G(L)->strt; |
1032 | int s = cast_int(luaL_optinteger(L, 1, 0)) - 1; | 1042 | int s = cast_int(luaL_optinteger(L, 1, 0)) - 1; |
@@ -1933,6 +1943,7 @@ static const struct luaL_Reg tests_funcs[] = { | |||
1933 | {"pushuserdata", pushuserdata}, | 1943 | {"pushuserdata", pushuserdata}, |
1934 | {"querystr", string_query}, | 1944 | {"querystr", string_query}, |
1935 | {"querytab", table_query}, | 1945 | {"querytab", table_query}, |
1946 | {"queryinc", query_inc}, | ||
1936 | {"ref", tref}, | 1947 | {"ref", tref}, |
1937 | {"resume", coresume}, | 1948 | {"resume", coresume}, |
1938 | {"s2d", s2d}, | 1949 | {"s2d", s2d}, |