procedures and environments

debray@CS.Arizona.EDU (Saumya K. Debray)
4 Nov 1999 00:36:11 -0500

          From comp.compilers

Related articles
procedures and environments debray@CS.Arizona.EDU (1999-11-04)
Re: procedures and environments (1999-11-05)
Re: procedures and environments (Max Hailperin) (1999-11-05)
Re: procedures and environments (David L Moore) (1999-11-05)
Re: procedures and environments (1999-11-05)
Re: procedures and environments (1999-11-09)
Re: procedures and environments (1999-11-09)
| List of all articles for this month |

From: debray@CS.Arizona.EDU (Saumya K. Debray)
Newsgroups: comp.compilers
Date: 4 Nov 1999 00:36:11 -0500
Organization: University of Arizona CS Department, Tucson AZ
Keywords: code, design, question

In most modern programming languages, procedure activations are
typically associated with their own environments, which means that a
procedure call involves two distinct actions: (1) the control transfer
from caller to callee; and (2) the allocation/initialization of the
callee's environment. Does anyone know of any [language-level]
proposal to separate these two actions? In other words, a call would
transfer control to the callee, which could either allocate an
environment, or---if it chose to not allocate an environment for
itself---execute in the caller's environment.

(The need for this comes up in some code compression work we're doing,
where we'd like to take identical code fragments and abstract them
into procedures. The problem is that the procedures so created need
to execute in their caller's environment. This feels like something
someone must have looked at...)

Any pointers to references would be greatly appreciated.
Saumya Debray
Dept. of Computer Science, University of Arizona, Tucson
[Seems to me it'd happen sort of automagically if a routine had no
variables of its own but instead used only variables from the up-level
routine. You'd skip allocating a frame pointer and use the caller's
frame. I agree that calling sequences without separate frame pointers
make this pretty yucky. -John]

Post a followup to this message

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