Comment by haberman
5 years ago
You really wouldn't. We tried many approaches, including computed goto, but none of them were able to generate satisfactory code when compared with tail calls: https://gcc.gnu.org/pipermail/gcc/2021-April/235891.html
Also, it is not an implicit optimization when "musttail" support is available in the compiler.
Tailcall optimization is compiled as a JMP, so is goto, so I'm curious where would the difference come from?
The tail call design gives more control over register allocation, and gets the compiler to generate better code by putting fast paths and slow paths in separate functions. I tried to explain this in the article and in my link upthread.