Re: Recursion with register optimised parameters.

"Jonathan Eifrig" <eifrig@acm.org>
15 Sep 1997 21:22:47 -0400

          From comp.compilers

Related articles
Recursion with register optimised parameters. cmain@iafrica.com (1997-09-12)
Re: Recursion with register optimised parameters. eifrig@acm.org (Jonathan Eifrig) (1997-09-15)
| List of all articles for this month |

From: "Jonathan Eifrig" <eifrig@acm.org>
Newsgroups: comp.compilers
Date: 15 Sep 1997 21:22:47 -0400
Organization: PSINet
References: 97-09-042
Keywords: optimize, functional, registers

Craig Main <cmain@iafrica.com> wrote:
> I was wondering how languages (like Delphi) handle recursion when their
> parameter passing is optimised to use the registers.
>
> It has been bugging me for some time now. The delphi inline assembler
> documentation states that under certain conditions a stack frame is not
even
> created for a procedure or function.
>
> [In most compilers, leaf procedures which don't need stack variables
> don't make a stack frame, other procedures all do. -John]


Well, usually "functional" languages like Lisp, Scheme, or ML will
implement tail recursion elimination, in which the caller's stack
frame is essentially recycled for use as the callee's stack frame.
Obviously, inlined functions don't use a stack frame.


The SML/NJ compiler is a continuation-based compiler, which converts
all control constructs into something very similar to tail recursive
functions, and the register-allocator will often assign variables to
registers so that function calls become just jumps. I'm not sure
that's what you're referring to, however, in your question about
"parameter passing optimized to use the registers."


  - Jonathan Eifrig (eifrig@acm.org)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.