[PRL] MSFT gives Joe Marshall kudos, decides Appel was right
after all
Dave Herman
dherman at ccs.neu.edu
Fri Jun 2 15:22:41 EDT 2006
> The problem is not the stack, per se; it's the bogus notion that you
> push on entry and pop on exit.
Ryan and Will have helped beat this assumption out of my brain by now
(oh, the years of C-induced brain damage...) but I'm not sure I
appreciate its gravity.
Certainly, leaf procedures may account for a huge percentage of an
execution trace, and many/all of those leaf procedures may not require a
stack frame. So I can see how this would be a big efficiency gain. But
is it just a "God, implementors are wasteful" point, or is there some
deeper (say, semantic) reason why this is significant?
Maybe I can actually answer my own question: some language definitions
*depend* on this assumption; for example, ECMAScript specifies an
"activation object" that exists during the execution of a procedure
body, with certain observations you can perform on that object. This
makes it hard for an implementation not to push on entry.
But this still has the feeling of enabling/thwarting a compiler
optimization, as opposed to proper tail recursion, which actually
significantly affects the way people write programs.
More succinctly: does the push-on-entry assumption affect the way people
write programs?
Dave
More information about the PRL
mailing list