Re: Optimization of Uncommon Code

mac@coos.dartmouth.edu (Alex Colvin)
10 Jul 1996 12:09:53 -0400

          From comp.compilers

Related articles
Re: Java virtual machine as target language for C/C++ kik@zia.cray.com (1996-05-08)
Optimization of Uncommon Code (Was Java ByteCode ...) dlmoore@ix.netcom.com (1996-06-30)
Re: Optimization of Uncommon Code (Was Java ByteCode ...) wws@renaissance.cray.com (Walter Spector) (1996-07-01)
Re: Optimization of Uncommon Code dwight@pentasoft.com (Dwight VandenBerghe) (1996-07-02)
Re: Optimization of Uncommon Code rweaver@ix.netcom.com (1996-07-03)
Re: Optimization of Uncommon Code leichter@smarts.com (Jerry Leichter) (1996-07-03)
Re: Optimization of Uncommon Code wws@renaissance.cray.com (Walter Spector) (1996-07-09)
Re: Optimization of Uncommon Code mac@coos.dartmouth.edu (1996-07-10)
Re: Optimization of Uncommon Code creedy@mitre.org (1996-07-13)
| List of all articles for this month |
From: mac@coos.dartmouth.edu (Alex Colvin)
Newsgroups: comp.compilers
Date: 10 Jul 1996 12:09:53 -0400
Organization: Dartmouth College, Hanover, NH, USA
References: 96-05-061 96-06-152 96-07-021 96-07-032 96-07-061
Keywords: code, history, architecture

>> The first implementation of Fortran was on the IBM 704.
>> ...
>> The implementation of argument
>> passing was that, on entry to a subroutine/function, initialization code
>> would insert the argument addresses passed into each instruction referencing
>> those arguments. Note "each", could take a while for routines with lots of
>> references to their arguments and this occurred on every invocation.


This may have been the case on some machines, but I believe a much
simpler mechanism was used. Arguments and locals are statically
allocated. Arguments are passed by simply assigning to them.
Arguments are referenced like any other static or global. The return
address is handled in similar fashion (like RJ or the 8's JSR).


There's no stack at all. Objviously recursion doesn't work. In fact,
I encountered fortran programs that relied on this - error handling
recursively called the main procedure to restart. I suppose that's
a case of tail-recursion elimination.


>Why was the address not simply added to the index at run-time
>when needed? Shortage of registers? (I'm thinking about that
>PDP-8 again...)


Even if you have more than one register, not everyone can spare an
adder for stack-relative addresing.


Recently I programmed a microcontroller with only one register and no
relative addressing. I used something like this.


--
Alex Colvin
alex.colvin@dartmouth.edu
--


Post a followup to this message

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