Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!ncar!noao!arizona!gudeman From: gudeman@cs.arizona.edu (David Gudeman) Newsgroups: comp.lang.misc Subject: Re: Algol, and language design Message-ID: <23822@megaron.cs.arizona.edu> Date: 2 Aug 90 21:42:35 GMT Organization: U of Arizona CS Dept, Tucson Lines: 38 In article <1990Aug2.165229.28079@rice.edu> preston@titan.rice.edu (Preston Briggs) writes: ]... many (most?) languages are ]not very amenable to interprocedural optimization... ]Currently, there are efficient methods for languages that have only ]statically declared procedures (no procedure variables or parameters, ]like people imagine when they wave their hands about interprocedural ]optimization). There are also versions that can handle procedure parameters ](like Fortran). Handling procedure-valued variables is very difficult ]and isn't done well or efficiently. This is a little deceptive. It is not a problem to do interprocedural optimization in a language that _allows_ procedure-valued variables, only for particular programs that _use_ such variables. A C program that uses no procedure-valued variables can easily be detected (at link-time) and optimized as though such variables were not allowed. Furthermore, a program that does use such variables doesn't have to suffer a huge performance hit unless the procedure variables are used all over the place and the procedures that are assigned to variables change a lot of global variables. If the uses are fairly isolated, or the assigned procedures are well-behaved, then most of the program can be optimized as thought they weren't there. The only real problem with procedure-valued variables (and interprocedural optimization in general) in C is that you have to do it at link time, over the whole program at once. This problem could be reduced if C allowed more informative declarations. Prototypes are a good start, but it would also be useful to allow extra declarations to specfy things like what globals are used and modified. Of course, these sorts of declarations can't be verified by the compiler because they depend on what procedures a given procedure calls. So there is still some work for the linker to do. -- David Gudeman Department of Computer Science The University of Arizona gudeman@cs.arizona.edu Tucson, AZ 85721 noao!arizona!gudeman