On Friday, 15 December 2023 at 12:51:47 -0500, Paul Winalski wrote:
The usual programming convention for IBM S/360/370
operating systems
(OS/360, OS/VS, TOS and DOS/360, DOS/VS) did not involve use of a
stack at all, unless one was writing a routine involving recursive
calls, and that was rare. Addressing for both program and data was
done using a base register + offset. PL/I is the only IBM HLL I know
that explicitly supported recursion. I don't know how they
implemented automatic variables assigned to memory in recursive
routines. It might have been a linked list rather than a stack.
Yes, the 360 architecture doesn't have a hardware stack. Subroutine
calls worked with was something like a linked list. Registers were
saved in a “save area", and they were linked.
At least in assembler (I never programmed HLLs under MVS), by
convention R13 pointed to the save area. From memory, subroutine
calls worked like:
LA 15,SUBR load address of subroutine
BALR 14,15 call subroutine, storing address in R14
The subroutine then starts
with
STM 14,12,12(13) save registers 14 to 12 (wraparound) in old save area
LA 14,SAVE load address of our save area
ST 14,8(13) save in linkage of old save area
LR 13,14 and point to our save areas
Returning from the subroutine was then
L 13,4(13) restore old save area
LM 14,12,12(13) restore the other registers
BR 14 and return to the caller
Clearly this example isn't recursive, since it uses a static save
area. But with dynamic allocation it could be recursive.
I remember when I first went from the IBM world and
started
programming VAX/VMS, I thought it was really weird to burn an entire
register just for a process stack.
Heh. Only one register?
/370 was an experience for me, one I never wanted to repeat.
Greg
--
Sent from my desktop computer.
Finger grog(a)lemis.com for PGP public key.
See complete headers for address and phone numbers.
This message is digitally signed. If your Microsoft mail program
reports problems, please read
http://lemis.com/broken-MUA.php