|Re: Java virtual machine as target language for C/C++ firstname.lastname@example.org (1996-05-08)|
|Optimization of Uncommon Code (Was Java ByteCode ...) email@example.com (1996-06-30)|
|Re: Optimization of Uncommon Code (Was Java ByteCode ...) firstname.lastname@example.org (Walter Spector) (1996-07-01)|
|Re: Optimization of Uncommon Code email@example.com (Dwight VandenBerghe) (1996-07-02)|
|Re: Optimization of Uncommon Code firstname.lastname@example.org (1996-07-03)|
|Re: Optimization of Uncommon Code email@example.com (Jerry Leichter) (1996-07-03)|
|Re: Optimization of Uncommon Code firstname.lastname@example.org (Walter Spector) (1996-07-09)|
|Re: Optimization of Uncommon Code email@example.com (1996-07-10)|
|Re: Optimization of Uncommon Code firstname.lastname@example.org (1996-07-13)|
|From:||email@example.com (Richard Weaver )|
|Date:||3 Jul 1996 10:36:37 -0400|
|References:||96-05-061 96-06-152 96-07-021|
|Keywords:||optimize, Fortran, history|
Walter Spector wrote:
> > This used to be a common misconception - that locals in Fortran were
> > static and therefore retained their values from one call of a
> > procedure to the next. This was how Fortran was implemented on
> > some early machines.
> I would say "almost all". And to this day, I still wonder why. Was there
> really a significant performance difference in the machines of the 1960s? I
> can think of cases where stack mode could create *faster* code than static
> mode. But admittedly modern hardware is in use.
You have the wrong decade, it was the 1950s that were different. In what
follows I've made no attempt to locate correct details as to when Fortran
acquired various features (e.g. subroutines) nor to distinguish between 704,
709, etc. implementations, as that work would not contribute to the core of
The first implementation of Fortran was on the IBM 704. It had index
registers but not 'base' registers, machine instructions contained the
absolute address, possibly indexed, of data. 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.
Users discovered that programs could be organized to avoid this overhead, by
keeping arguments in the same (static) locations and having an initial
invocation that was passed all arguments, thus filling in all addresses, and
on later invocations specifying no arguments.
A routine have 3 invocations, such as
CALL X (A)
CALL Y (B)
CALL Z (C)
acquired a 4th invocation and the existing 3 lost their argument specification
CALL FIRST (A,B,C) Call once, at beginning of MAIN.
Since the CALL FIRST had inserted the address of A,B,C into the instructions
referencing them, the later calls needed no arguments -- the addresses were
already in place!
Thus "parameter persistence" came into being. And Fortran code came into
being that was dependent on parameter persistence. So when new Fortrans were
implemented on new architectures ("stack", for example) those new Fortrans,
desiring to run existing Fortran programs, implemented parameter
persistence. And when still newer Fortrans were implemented ....
Hope this helped
[This revolting technique was still a win in 360 Fortran due to its slow
copy in/copy out argument passing. -John]
Return to the
Search the comp.compilers archives again.