From 5d8ce05b3f6fad79e37ed21c1076e47a322472c6 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 21 Sep 2020 10:31:03 -0300 Subject: Back to a stackless implementation A "with stack" implementation gains too little in performance to be worth all the noise from C-stack overflows. This commit is almost a sketch, to test performance. There are several pending stuff: - review control of C-stack overflow and error messages; - what to do with setcstacklimit; - review comments; - review unroll of Lua calls. --- testes/all.lua | 4 ++-- testes/cstack.lua | 2 ++ testes/errors.lua | 7 +++---- 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'testes') diff --git a/testes/all.lua b/testes/all.lua index db074dd8..a4feeec1 100644 --- a/testes/all.lua +++ b/testes/all.lua @@ -127,8 +127,8 @@ else end Cstacklevel = function () - local _, _, ncalls, nci = T.stacklevel() - return ncalls + nci -- number of free slots in the C stack + local _, _, ncalls = T.stacklevel() + return ncalls -- number of C calls end end diff --git a/testes/cstack.lua b/testes/cstack.lua index 4e37b988..c1177f3b 100644 --- a/testes/cstack.lua +++ b/testes/cstack.lua @@ -1,6 +1,8 @@ -- $Id: testes/cstack.lua $ -- See Copyright Notice in file all.lua +do return end + local debug = require "debug" print"testing C-stack overflow detection" diff --git a/testes/errors.lua b/testes/errors.lua index f9623b1d..88918df7 100644 --- a/testes/errors.lua +++ b/testes/errors.lua @@ -530,10 +530,9 @@ local function testrep (init, rep, close, repc, finalresult) if (finalresult) then assert(res() == finalresult) end - s = init .. string.rep(rep, 10000) - local res, msg = load(s) -- 10000 levels not ok - assert(not res and (string.find(msg, "too many registers") or - string.find(msg, "stack overflow"))) + s = init .. string.rep(rep, 500) + local res, msg = load(s) -- 500 levels not ok + assert(not res and string.find(msg, "too many")) end testrep("local a; a", ",a", "= 1", ",1") -- multiple assignment -- cgit v1.2.3-55-g6feb