At 11:16 AM -0800 11/11/04, Jeff Clites wrote:
On Nov 11, 2004, at 9:44 AM, Michael Walter wrote:

On Thu, 11 Nov 2004 12:30:16 -0500, Dan Sugalski <[EMAIL PROTECTED]> wrote:
Tail calls should be explicit, compile-time things. Otherwise we're
going to run afoul of traceback requirements and suchlike things

Nah, that's just the difference between running optimized and unoptimized. Actually, with a tailcall op that's effectively a hint, it would be ideal to have 3 run modes: a "just obey the hints" mode (for those that trust their compiler), a "never do a tail call" mode (for debugging purposes), and a "do tail calls whenever possible" mode (independent of whether the tailcall op was used). Not sure if those are run modes or assembler (optimizer) modes, though.

Still, the only way we know they're valid to do is if we're told so. If the compilers allow it then they can do it themselves.


Even further, it's necessary for some languages
(Scheme)/paradigms (loop by recursion) that a "tailcall" is not just a
hint but mandatory.

I think that actually doesn't matter. Even in the case where we think we can't do a full tail call optimization (because of a continuation that's been taken), we can still actually remove the calling frame from the call stack--we just can't immediately re-use the register frame. That satisfies the Scheme requirement, I would think. You can still do unbounded recursion, just that GC may need to run to clean up call frames.

I only skimmed the earlier parts of this, but continuations shouldn't affect tail calls at all. There's certainly no reason they ought to. All a tail call does is use the current return continuation as the return continuation for the call you're making. That's not affected by taking a continuation.


If this is from some side effect of call speed optimization (I remember seeing some discussion of stack allocation of call frames or something, but I don't recall if it was before or after I said we weren't optimizing this stuff right now) then we need to rip out those optimizations. If there's some other reason then it needs to get fixed, as we've got something else broken.
--
Dan


--------------------------------------it's like this-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to