aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-09-21 10:31:03 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-10-12 12:29:09 -0300
commit5d8ce05b3f6fad79e37ed21c1076e47a322472c6 (patch)
tree7629a59887da63d44267e872bc8e33be6db36582 /testes
parentf83de8e34e24e30acf277f60de62a33bd51d1ddd (diff)
downloadlua-5d8ce05b3f6fad79e37ed21c1076e47a322472c6.tar.gz
lua-5d8ce05b3f6fad79e37ed21c1076e47a322472c6.tar.bz2
lua-5d8ce05b3f6fad79e37ed21c1076e47a322472c6.zip
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.
Diffstat (limited to 'testes')
-rw-r--r--testes/all.lua4
-rw-r--r--testes/cstack.lua2
-rw-r--r--testes/errors.lua7
3 files changed, 7 insertions, 6 deletions
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
127 end 127 end
128 128
129 Cstacklevel = function () 129 Cstacklevel = function ()
130 local _, _, ncalls, nci = T.stacklevel() 130 local _, _, ncalls = T.stacklevel()
131 return ncalls + nci -- number of free slots in the C stack 131 return ncalls -- number of C calls
132 end 132 end
133end 133end
134 134
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 @@
1-- $Id: testes/cstack.lua $ 1-- $Id: testes/cstack.lua $
2-- See Copyright Notice in file all.lua 2-- See Copyright Notice in file all.lua
3 3
4do return end
5
4local debug = require "debug" 6local debug = require "debug"
5 7
6print"testing C-stack overflow detection" 8print"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)
530 if (finalresult) then 530 if (finalresult) then
531 assert(res() == finalresult) 531 assert(res() == finalresult)
532 end 532 end
533 s = init .. string.rep(rep, 10000) 533 s = init .. string.rep(rep, 500)
534 local res, msg = load(s) -- 10000 levels not ok 534 local res, msg = load(s) -- 500 levels not ok
535 assert(not res and (string.find(msg, "too many registers") or 535 assert(not res and string.find(msg, "too many"))
536 string.find(msg, "stack overflow")))
537end 536end
538 537
539testrep("local a; a", ",a", "= 1", ",1") -- multiple assignment 538testrep("local a; a", ",a", "= 1", ",1") -- multiple assignment