diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-12 10:31:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-06-12 10:31:38 -0300 |
commit | 3cd9b56ae6002b4ef28d2467abd119606ae625d3 (patch) | |
tree | ac8d7f3986a3b318ccd4e1b6c8e7661d199c0de7 /testes/all.lua | |
parent | d2a9b4ffb86de29a201843edddfc0153a1846f96 (diff) | |
download | lua-github-3cd9b56ae6002b4ef28d2467abd119606ae625d3.tar.gz |
Revamp around 'L->nCcalls' count
The field 'L->nCcalls' now counts downwards, so that the C-stack
limits do not depend on the stack size.
Diffstat (limited to 'testes/all.lua')
-rw-r--r-- | testes/all.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/testes/all.lua b/testes/all.lua index 2e6fe038..72121e8d 100644 --- a/testes/all.lua +++ b/testes/all.lua @@ -95,6 +95,8 @@ local function F (m) end end +local Cstacklevel + local showmem if not T then local max = 0 @@ -104,6 +106,7 @@ if not T then print(format(" ---- total memory: %s, max memory: %s ----\n", F(m), F(max))) end + Cstacklevel = function () return 0 end -- no info about stack level else showmem = function () T.checkmemory() @@ -117,9 +120,16 @@ else T.totalmem"string", T.totalmem"table", T.totalmem"function", T.totalmem"userdata", T.totalmem"thread")) end + + Cstacklevel = function () + local _, _, ncalls, nci = T.stacklevel() + return ncalls + nci -- number of free slots in the C stack + end end +local Cstack = Cstacklevel() + -- -- redefine dofile to run files through dump/undump -- @@ -211,6 +221,10 @@ debug.sethook(function (a) assert(type(a) == 'string') end, "cr") -- to survive outside block _G.showmem = showmem + +assert(Cstack == Cstacklevel(), + "should be at the same C-stack level it was when started the tests") + end --) local _G, showmem, print, format, clock, time, difftime, |