The cost of guaranteed tail call optimization is that you have to adopt the Pascal (callee side) convention for stack frame cleanup, so functions can’t reuse outgoing argument space. Does it matter in practice? Dunno.
-
-
Replying to @pcwalton
I don't understand what you mean by "reuse": if a fn makes multiple non-tail calls it reuses a region of stack for each; and if it finishes with a tail call, it reuses the place its own inbound args went. What am I missing?
1 reply 0 retweets 0 likes -
Replying to @leastfixedpoint
The problem is if you tail call a function that takes more argument space than you do.
2 replies 0 retweets 0 likes
Replying to @pcwalton @leastfixedpoint
(What you describe is called "sibling call optimization", and it's a special case of TCO. GCC and LLVM will do sibling call optimization since it works with the C calling convention.)
1:29 PM - 19 Oct 2018
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.