diff options
author | Steve Bennett <steveb@workware.net.au> | 2020-04-02 20:43:55 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2020-04-02 21:52:20 +1000 |
commit | 0d5a208e9240218757e0d4658f9b0d14a4263831 (patch) | |
tree | 769fb1ab1a54ae9bd67d5f5d85012f29704b18c9 /tests/tailcall.test | |
parent | bd7037fdd108729999cfb32a1304abd0eec1d1ad (diff) | |
download | jimtcl-0d5a208e9240218757e0d4658f9b0d14a4263831.zip jimtcl-0d5a208e9240218757e0d4658f9b0d14a4263831.tar.gz jimtcl-0d5a208e9240218757e0d4658f9b0d14a4263831.tar.bz2 |
tailcall: Fix to avoid tailcalls consuming C stack frames
The purpose of a tailcall is to avoid using additional stack frames,
however although were were not creating an extra Tcl callframe we were
using C stack frames through the call sequence:
JimCallProcedure -> Jim_EvalObjList -> JimInvokeCommand -> JimCallProcedure
This meant that a large number of tailcalls would overflow the stack.
Instead we need to have JimCallProcedure return to JimInvokeCommand
where the tailcall can be handled by a subsequent call to JimCallProcedure.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/tailcall.test')
-rw-r--r-- | tests/tailcall.test | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/tailcall.test b/tests/tailcall.test index eaa48cc..b2dc70a 100644 --- a/tests/tailcall.test +++ b/tests/tailcall.test @@ -87,7 +87,7 @@ test tailcall-1.9 {tailcall with large number of invocations} { incr n -1 tailcall a $n } - a 1000 + a 100000 } 1 test tailcall-1.10 {tailcall through uplevel} { |