Re: Why do we still assemble?

mps@dent.uchicago.edu (Michael Spertus)
Thu, 14 Apr 1994 14:06:29 GMT

          From comp.compilers

Related articles
[24 earlier articles]
Re: Why do we still assemble? pardo@cs.washington.edu (1994-04-13)
Re: Why do we still assemble? hbaker@netcom.com (1994-04-13)
Re: Why do we still assemble? ok@cs.rmit.oz.au (1994-04-13)
Re: Why do we still assemble? rfg@netcom.com (1994-04-13)
Re: Why do we still assemble? rfg@netcom.com (1994-04-13)
Re: Why do we still assemble? zstern@adobe.com (1994-04-13)
Re: Why do we still assemble? mps@dent.uchicago.edu (1994-04-14)
Re: Why do we still assemble? bill@amber.ssd.csd.harris.com (1994-04-14)
Re: Why do we still assemble? hbaker@netcom.com (1994-04-14)
Re: Why do we still assemble? djohnson@arnold.ucsd.edu (1994-04-15)
Re: Why do we still assemble? philw@tempel.research.att.com (1994-04-15)
Re: Why do we still assemble? pardo@cs.washington.edu (1994-04-15)
Re: Why do we still assemble? wirzeniu@cc.helsinki.fi (Lars Wirzenius) (1994-04-16)
[3 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: mps@dent.uchicago.edu (Michael Spertus)
Keywords: design, linker
Organization: Dept. of Mathematics
References: 94-04-032 94-04-082
Date: Thu, 14 Apr 1994 14:06:29 GMT

I wrote the linker and assembler for Coherent (a unix look alike by Mark
Williams where I no longer work.). There were two reasons why we won all
the Compiler speed benchmarks.


The first was that the Compiler generated object code directly unless you
ask for assembler. The trick there is that you write emit() statements
which have all the stuff required for assembler or object code and then
only produce the right one. To get more speed make emit() a macro. Now
produce two versions of the last phase of your compiler with different
versions of emit defined.


This is really a form of partial evaluation, you are projecting different
versions of the compiler's last phase specialized to producing commented
assembler or object code.


The second and more important reason (in terms of timing) was the linker.
The secret here was a philosophy I call "see file eat file". When you see
you need an object file get its length malloc enough room and read it in.
You won't run out of space on unix. Then do all the fixes and write it
out, its a little tricky to avoid seeks but not terrable. The result was a
screaming fast (by comparison) linker that used less than 5000 lines of C.
It REALLY should have been in C++ but we didn't use it for management
reasons and as a result if they want to go to something other than COFF
the best path will be a rewrite.


When linkers are slow its generally because they avoid "see file eat file"
and this forces them to seek around. The results can be thousands of times
slower. When I hear of the Microsoft linker running overnight (I never
tried it myself) I know that is what happened. Better to write your own
pager and encapsulate paging than to seek around data files.
--


Post a followup to this message

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