Re: PCODE Interpereters 101

aduncan <aduncan@cs.ucsb.edu>
21 Feb 1999 21:43:41 -0500

          From comp.compilers

Related articles
[5 earlier articles]
Re: PCODE Interpereters 101 gneuner@dyn.com (1999-02-05)
Re: PCODE Interpereters 101 cfc@world.std.com (Chris F Clark) (1999-02-10)
Re: PCODE Interpereters 101 sam@cogent.ca (Sam Roberts) (1999-02-12)
Re: PCODE Interpereters 101 kevin.b.smith@intel.com (Kevin B. Smith) (1999-02-15)
Re: PCODE Interpereters 101 cfc@world.std.com (Chris F Clark) (1999-02-15)
Re: PCODE Interpereters 101 toring@inet.uni2.dk (Torben Ring) (1999-02-18)
Re: PCODE Interpereters 101 aduncan@cs.ucsb.edu (aduncan) (1999-02-21)
Re: PCODE Interpereters 101 albaugh@agames.com (1999-02-24)
Re: PCODE Interpereters 101 Scott.Daniels@Acm.Org (Scott.David.Daniels) (1999-03-02)
| List of all articles for this month |

From: aduncan <aduncan@cs.ucsb.edu>
Newsgroups: comp.compilers
Date: 21 Feb 1999 21:43:41 -0500
Organization: U.C. Santa Barbara
References: 99-01-079 99-01-117 99-02-094
Keywords: interpreter, comment

Scott Amspoker wrote:
> I always felt that P-code's static links weren't a very efficient
> way to handle the problem. The PUSH and POP instructions
> (LOAD/SAVE, whatever) contained the lexical level of the variable as
> well as its offset within its stack frame. For "global" variables
> and variables in the current frame, it was reasonably efficient.
> However, for variables somewhere in between, the engine had to
> follow the static links the necessary number of steps to locate the
> desired frame.


I recall reading (citations, anyone?) that the vast majority of
variable references in real programs are either local or global; that
is, references to variables somewhere in the middle of the scope chain
are much less common. So obsessing over the efficiency or lack of it
for static link traversal vs. display updating is probably not worth
the time. Or put it this way: if you've fretted about it for almost
any amount of time, it will be more time than you'd save by
optimizing.


Andrew Duncan
aduncan@cs.ucsb.edu
[I would guess that there are some programs whose performance depends
greatly on the speed of up-level references, but not many. -John]


Post a followup to this message

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