Mill Computing, Inc. › Forums › The Mill › Architecture › Execution › Reply To: Execution
In the talk you describe how the Mill does tail calls “in hardware, for free”. You use the example of F(G(a+b)), such that the two calls happen in one instruction, and that the call to G actually returns directly to F, not to the calling frame.
I’m having a hard time fitting these with the model of tail calls that I’m familiar with. This is where calls in “tail position” (basically, being the last instruction before a return that’s either void, or returns the result of that call) are optimized such that the stack frame of the function is destroyed and execution jumps (rather than calling) to the function in tail call position.
This is most visible in recursive functions, where tail call optimization can often turn a function that will quickly hit a stack overflow (i.e. one that uses stack space proportional to some non-constant function of the input) into a function that completes fine, having used a constant amount of stack space.
As always, wikipedia explains it better: http://en.wikipedia.org/wiki/Tail_call.
Could someone help me reconcile these two models? How does the Mill’s “tail calls” (forgive the quotes) relate (if at all) to tail call optimization, which is often vitally important in functional languages?