2 ms·
You don't need VM support for tail self-calls (which is exactly what Clojure supports with `recur`), but you sure do for optimizing tail calls to other function
by denisw 9y ago
You don't need VM support for tail self-calls (which is exactly what Clojure supports with `recur`), but you sure do for optimizing tail calls to other functions. There is no way in the JVM to say "replace my stack frame with a new one for that other method and execute that", especially not one that gives you a useful stacktrace for debugging.
- catnaroek 9y ago> There is no way in the JVM to say "replace my stack frame with a new one for that other method and execute that" Nor does there need to be one, because translating function calls to jumps is the (AOT) compiler's business, not the VM's.
- pjmlp 9y agoThe CLR has byte codes for tail calls, properly named .tail..