[TDR] Mixed Language Compiling

Fri, 8 Jan 1993 02:39:38 GMT

          From comp.compilers

Related articles
[TDR] Mixed Language Compiling TDARCOS@MCIMAIL.COM (Paul Robinson) (1993-01-08)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Paul Robinson <TDARCOS@MCIMAIL.COM>
Organization: Compilers Central
Date: Fri, 8 Jan 1993 02:39:38 GMT
Keywords: optimize, design

When I was doing programming on the Univac 90/60 series machines on VS/9,
(A mainframe with a better operating system than anything IBM has ever
made, with the identical machine code as a 360 plus some of the 370
features) it had the capability to do mixed language programming, and the
language manuals showed you how.

You could call a FORTRAN subroutine from a COBOL main program or COBOL
called program. You could also call an assembly language program or an
assembly language program could call these. You simply had to code the
parameters for passing arguments correctly.

The reason this worked is that IBM developed a standard calling convention
for programs written for the IBM 360 series machines: Register 13 points
to a save area to store the other registers. Register 1 is a pointer to
the list of arguments. Register 0 is a return value for integer return
values. Floating point register 0 is the return value for REAL
subroutines. Even the software that UNIVAC wrote for its IBM 360/370
clone used the same conventions as IBM software.

What was interesting is the termination code. On a Univac 90/60, VS/9
used two supervisor calls; SVC 9 to clear all terminal and I/O buffers,
and SVC 28 to indicate program termination. Under IBM's DOS/VSE operating
system, only SVC 14 was needed for program termination. Something makes
me suspect the COBOL compiler was the same on both; a STOP RUN code on
VS/9 generates SVC 9 / SVC 28. A stop run code on DOS/VSE generates SVC
14 / SVC 14.

Digital Equipment Corporation's RT11 operating system did something
similar. Register 5 points to a list of arguments (if any), with the
hardware providing register 6 as a stack and register 7 as the Program
Counter. So you simply passed arguments around.

When MS-DOS came out, there were no standard conventions for the passing
of arguments from one language to another. As a result the "standards",
if any, are ad-hoc. There is little or no standardization between
languages except on a limited level, with some compilers using the BX
register as a pointer and some using INT calls with argument lists pointed
to by anything. There is really no standardization because the people who
designed these things had no thought to people wanting to use multiple

What does this tell us? That we are inventing the wheel all over again,
that all the lessons painfully and expensively learned over thousands of
man-years in the mainframe programming environment are being re-learned
all over again, at significant expense, in the PC environment.


Post a followup to this message

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