Re: PCODE Interpereters 101

Chris F Clark <>
10 Feb 1999 18:15:20 -0500

          From comp.compilers

Related articles
PCODE Interpereters 101 (Carl Dawson) (1999-01-22)
Re: PCODE Interpereters 101 (Dwight Hughes) (1999-01-23)
Re: PCODE Interpereters 101 (1999-01-31)
Re: PCODE Interpereters 101 (Tom Lane) (1999-02-03)
Re: PCODE Interpereters 101 (1999-02-05)
Re: PCODE Interpereters 101 (1999-02-05)
Re: PCODE Interpereters 101 (Chris F Clark) (1999-02-10)
Re: PCODE Interpereters 101 (Sam Roberts) (1999-02-12)
Re: PCODE Interpereters 101 (Kevin B. Smith) (1999-02-15)
Re: PCODE Interpereters 101 (Chris F Clark) (1999-02-15)
Re: PCODE Interpereters 101 (Torben Ring) (1999-02-18)
Re: PCODE Interpereters 101 (aduncan) (1999-02-21)
Re: PCODE Interpereters 101 (1999-02-24)
[1 later articles]
| List of all articles for this month |

From: Chris F Clark <>
Newsgroups: comp.compilers
Date: 10 Feb 1999 18:15:20 -0500
Organization: The World Public Access UNIX, Brookline, MA
References: 99-01-079 99-01-117 99-02-008 99-02-019
Keywords: Pascal, code

> Actually, displays can be very efficient at the procedure call point.

Yes, this is true, especially if one is willing to do some compile
time analysis and accept displays which are only partially filled in.
Back in my Prime Computer days our compilers used displays and we
spent some time optimizing them. Some of the things we exploited were
noticing which upper level procedures were actually accessed and which
were not. This optimized the fact that a lot of the up-scope accesses
were to one "top-level" routine and the display only had to hold the
link to that routine and not any of the intermediaries. I believe we
even moved the code which filled the displays slots down in the code,
so that the display did not get filled in until the first up-scope
access could occur. (I think that you can get displays to nearly
approximate the static link case, even for the static link's most
efficient case if one works hard enough; and displays are definitely
better for cases where static links are not efficient.)

> My main axe these days is C++ and I often have a situation where I
> would use lexical nesting if I could.

Actually, the solution in C++ is to make an "object" out of the
variables you want as your enclosing scope. All of your nested
functions them are members of that. It gives you efficient access to
the enclosing variables etcetra and it doesn't require any change to
the language. It just isn't as pretty syntactically. (You could even
write a preprocessor, to extract nested procedures and turn them and
the up-level variables they referenced into objects, if you wanted a
"pretty" solution.)

Hope this helps,

Chris Clark Internet :
Compiler Resources, Inc. CompuServe : 74252,1375
3 Proctor Street voice : (508) 435-5016
Hopkinton, MA 01748 USA fax : (508) 435-4847 (24 hours)
Web Site in Progress: Web Site :

Post a followup to this message

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