From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99ab4bb580fc34cd X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Q: access to subprogram Date: 1996/07/09 Message-ID: #1/1 X-Deja-AN: 167536576 references: <4rb9dp$qe6@news1.delphi.com> <4re2ng$t7u@wdl1.wdl.loral.com> <4rud55$5b0@fu-berlin.de> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-07-09T00:00:00+00:00 List-Id: Thomas Wolff said Why should displays be a menace where static links are not? Who would actually prefer to really follow static links at all, effectively almost *searching* for variables at run-time? Until now I thought this would only be a theoretical concept and perhaps one of very early compilers. Static links are by far the more common way of hanling uplevel references, and are far from being "only a theoretical concept". Most modern compilers use static links. There is no searching involved, just loading the entries that are needed, and if they are used frequently, they will stay in registers anyway. In fact the idea of static links came a little later on, the early Algol-60 compilers used displays. Why not just push the display on the stack and pass its address?? (If you really wanted to pass the display itself for some reason, you could still use the program's maximal display size, wasting a few bytes in these occasional cases.) That's the original Algol-60 approach but it is never used these days that I know of, since it is in practice definitely inferior to both static links and the use of global displays. It introduces unconditionally a large overhead of copying the display at every call whether or not it is useful to do so. (Yes, I know the Intel x86 hardware uses that approach. I use this as one of the examples of very bad CISC design, not only is an over-complex instruction built-in, but it is a bad algorithm that is built-in!)