3 ms·
If it doesn't control both then TCO is impossible, because the stack will grow with each recursive step, as it's just performing a normal call.
by fluoridation 2mo ago
If it doesn't control both then TCO is impossible, because the stack will grow with each recursive step, as it's just performing a normal call.
- layer8 2mo agoIt's possible for calling conventions where the callee is responsible for stack cleanup before return.
- uecker 2mo agoHave your mind blown: https://godbolt.org/z/xnn3PPxvW https://godbolt.org/z/xnn3PPxvW
- fluoridation 2mo agoExtremely specific example is uncompelling.
- uecker 2mo agoIt is a simple counterexample to your incorrect statement.
- fluoridation 2mo agoIt's still impossible in the general case, where not all arguments are passable by registers.
- uecker 2mo agoYou are right that there are cases where it is not possible. But it also works when arguments are not passed in registers. The condition then is that there are less stack slots used than in the caller. https://godbolt.org/z/M4Eqzh3YE https://godbolt.org/z/M4Eqzh3YE