From: glen herrmannsfeldt on
Richard Maine <nospam(a)see.signature> wrote:
(snip)

> One of the more esoteric features of the CDC segloader was that you
> could call a procedure in a segment that "overlaid" the one you were
> calling from. The argument list was copied into some temporary location
> so that you didn't lose it when the calling procedure swapped out.

The OS/360 overlay feature didn't do that. For assembly programs,
you could arrange so that A called B called C, and then returned
directly to A. That is, instead of doing a CALL, B does a branch
directly to C, with the return address ready for a return to A.

I don't know of any high level languages that implement that, but
it is convenient optimization for tail recursion. (When a
recursive routine calls itself just before the return statement.)

> That feature of copying the argument list had some "nasty" consequences
> if your actual and dummy argument lists did not agree on the number of
> arguments.

(snip)

-- glen
From: David Duffy on
glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:
> The OS/360 overlay feature didn't do that. For assembly programs,
> you could arrange so that A called B called C, and then returned
> directly to A. That is, instead of doing a CALL, B does a branch
> directly to C, with the return address ready for a return to A.

> I don't know of any high level languages that implement that, but
> it is convenient optimization for tail recursion.

If you google "TCO" you will find it in many functional languages (it is
compulsory for scheme interpreters, for example).

Just 2c, David.

--
| David Duffy (MBBS PhD) ,-_|\
| email: davidD(a)qimr.edu.au ph: INT+61+7+3362-0217 fax: -0101 / *
| Epidemiology Unit, Queensland Institute of Medical Research \_,-._/
| 300 Herston Rd, Brisbane, Queensland 4029, Australia GPG 4D0B994A v
From: robin on
"glen herrmannsfeldt" <gah(a)ugcs.caltech.edu> wrote in message news:hte7fq$tqe$1(a)speranza.aioe.org...

| In the days of ones complement and sign magnitude integers,
| a system could use negative zero as an illegal value,

Not when such values are ordinarily generated in the course of
any arithmetic.


From: robin on
"glen herrmannsfeldt" <gah(a)ugcs.caltech.edu> wrote in message news:hte88e$v02$1(a)speranza.aioe.org...
|
| One that happened to me a looong time ago in PL/I with CONTROLLED
| variables (similar to Fortran ALLOCATABLE) was accidentally FREEing
| and reALLOCATEing a variable, which happened to again use the same
| memory space. That could also happen on a stack with automatic
| variables. For a simple program, it might seem to work.
| In a more complicated program, something else will overwrite the
| memory location. In my PL/I program, I changed something else
| and the values changed. Then I had to track down why.

That would have been avoided by using the INITIAL attribute
in the ALLOCATE statenent, or by assigning some constant value
immediately after the ALLOCATE.


From: glen herrmannsfeldt on
David Duffy <davidD(a)orpheus.qimr.edu.au> wrote:
(snip on tail recursion optimization)

>> I don't know of any high level languages that implement that, but
>> it is convenient optimization for tail recursion.

> If you google "TCO" you will find it in many functional languages (it is
> compulsory for scheme interpreters, for example).

Interpreted languages are a different question. (and also I don't
know scheme.)

But also, what I meant was an explicit statement for tail recursion,
something like the OS/360 XCTL system call.

XCTL is similar to the unix exec() call, except that OS/360
doesn't use a stack. The XCTL target will return to the original
caller, just as needed for tail recursion optimization.

-- glen