Newsgroups: comp.compilers Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!world!iecc!compilers-sender From: carter@cs.wisc.edu (Gregory Carter) Subject: Code folding from JSR/RTS -> {Local} Message-ID: <1991May1.035622.25021@daffy.cs.wisc.edu> Summary: Speed and redundancy in fault tolerant Compiler Systems Keywords: optimize, architecture Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: carter@cs.wisc.edu (Gregory Carter) Organization: U of Wisconsin CS Dept References: <9104262025.AA21840@enuxva.eas.asu.edu> <7524@ecs.soton.ac.uk> Date: Wed, 1 May 91 03:56:22 GMT Approved: compilers@iecc.cambridge.ma.us Hello... I don't know if this is incredibly obvious or what, but in the OLDEN DAYS when I was working on a 6502 machine. Speed was of the upmost...ad nauseum.. What I want to know, if any of you have considered, for high speed applications to get that extra push, what the problems would be in compiler design to: 1) Transcribe all local variables to global ones. 2) Replacing subroutine calls with the actual code. 3) minimizing stack frame usage to almost ZIPPO. I have done this so often by hand, I wish I could tell my compiler to do it! For example: #...ad nauseum sub1() { ... } main() { sub1() } -> My mythical switch -L (Local data and code segments -> global state) results in the above being transcribed to: main() { ... } No stack frames, no parameters, no slow stack model, DUMP THOSE JSR's/RTS's link/unlnk instructions! GIVE ME JMP PERIOD. Since the compiler handles the transcription, Hey! We can still have readable modular ad nauseum type code on the C source level. Of course, this is REDUNDANT, in that code is replicated all over the place. Millions of machine cycles can be saved, though...depending on your computer. I think this method will be more and more attractive as memory prices go through the floor. I don't see why just because us humans have to think about inefficient stack models, why must the computer be made to do it this way when we don't need it too? Problem is, will the transcription of the code generation part of the compiler be able to do this when you want to shift from a stack based paradigm to a non stack based paradigm. --Gregory (Undergrad for life) [GCC and some other C compilers permit you do declare a procedure "inline" so that it is expanded wherever it is called. That gives pretty much the same effect, faster but larger code. -John] -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.