Newsgroups: comp.arch
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!barmar
From: barmar@think.com (Barry Margolin)
Subject: Re: Compilers and efficiency
Message-ID: <1991Apr23.162814.20093@Think.COM>
Sender: news@Think.COM
Organization: Thinking Machines Corporation, Cambridge MA, USA
References: <12740@pt.cs.cmu.edu> <MEISSNER.91Apr21153714@curley.osf.org> <1991Apr23.151932.2125@zoo.toronto.edu>
Date: Tue, 23 Apr 91 16:28:14 GMT

In article <1991Apr23.151932.2125@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
>In article <MEISSNER.91Apr21153714@curley.osf.org> meissner@osf.org (Michael Meissner) writes:
>>| ... The reason it was easy was because the machine code for a
>>| procedure prologue, contained (get this) a *call* to the runtime
>>| package...
>>If I remember correctly, the Unix V6 (Ritchie) compiler did this too...
>All instantiations of the Ritchie compiler did it, in fact.  On the whole,
>it made sense:  it saved code space, which was usually more of an issue on
>the 11 than execution time.  And it wasn't actually that much slower than
>inlining the relevant code, given that we're talking about machines that
>had little or no pipelining.

On Multics, external procedures also make a call to the runtime system
(called "operators", for some reason -- I guess to distinguish the library
routines that the compiler "knows" about from the ones that it doesn't)
during the standard entry sequence.

Besides reducing code space, it is a very useful feature of the software
development environment.  The operator procedures are addressed through a
transfer vector.  Thus, alternate versions of the operators could be
dynamically linked into the process (similar to the way personal computer
customizations patch trap vectors).  The most notable uses of this are the
procedure call tracing mechanism and the metering facility.  On most
systems, one must compile a program with a special option in order to make
it maintain metering statistics; on Multics, one just issues a command that
switches operators, runs the program, and then switch back to the regular
operators (there's a program that combines all this).  For call tracing,
one switches to versions of the entry and exit operators that display a
message.
--
Barry Margolin, Thinking Machines Corp.

barmar@think.com
{uunet,harvard}!think!barmar
