home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / compiler / 2115 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  3.2 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!ogicse!das-news.harvard.edu!spdcc!iecc!compilers-sender
  2. From: TDARCOS@MCIMAIL.COM (Paul Robinson)
  3. Newsgroups: comp.compilers
  4. Subject: [TDR] Mixed Language Compiling
  5. Keywords: optimize, design
  6. Message-ID: <93-01-042@comp.compilers>
  7. Date: 8 Jan 93 02:39:38 GMT
  8. Article-I.D.: comp.93-01-042
  9. Sender: compilers-sender@iecc.cambridge.ma.us
  10. Reply-To: Paul Robinson <TDARCOS@MCIMAIL.COM>
  11. Organization: Compilers Central
  12. Lines: 51
  13. Approved: compilers@iecc.cambridge.ma.us
  14.  
  15. When I was doing programming on the Univac 90/60 series machines on VS/9,
  16. (A mainframe with a better operating system than anything IBM has ever
  17. made, with the identical machine code as a 360 plus some of the 370
  18. features) it had the capability to do mixed language programming, and the
  19. language manuals showed you how.
  20.  
  21. You could call a FORTRAN subroutine from a COBOL main program or COBOL
  22. called program.  You could also call an assembly language program or an
  23. assembly language program could call these.  You simply had to code the
  24. parameters for passing arguments correctly.
  25.  
  26. The reason this worked is that IBM developed a standard calling convention
  27. for programs written for the IBM 360 series machines: Register 13 points
  28. to a save area to store the other registers.  Register 1 is a pointer to
  29. the list of arguments.  Register 0 is a return value for integer return
  30. values.  Floating point register 0 is the return value for REAL
  31. subroutines.  Even the software that UNIVAC wrote for its IBM 360/370
  32. clone used the same conventions as IBM software.
  33.  
  34. What was interesting is the termination code.  On a Univac 90/60, VS/9
  35. used two supervisor calls; SVC 9 to clear all terminal and I/O buffers,
  36. and SVC 28 to indicate program termination.  Under IBM's DOS/VSE operating
  37. system, only SVC 14 was needed for program termination.  Something makes
  38. me suspect the COBOL compiler was the same on both; a STOP RUN code on
  39. VS/9 generates SVC 9 / SVC 28.  A stop run code on DOS/VSE generates SVC
  40. 14 / SVC 14.
  41.  
  42. Digital Equipment Corporation's RT11 operating system did something
  43. similar.  Register 5 points to a list of arguments (if any), with the
  44. hardware providing register 6 as a stack and register 7 as the Program
  45. Counter.  So you simply passed arguments around.
  46.  
  47. When MS-DOS came out, there were no standard conventions for the passing
  48. of arguments from one language to another.  As a result the "standards",
  49. if any, are ad-hoc.  There is little or no standardization between
  50. languages except on a limited level, with some compilers using the BX
  51. register as a pointer and some using INT calls with argument lists pointed
  52. to by anything.  There is really no standardization because the people who
  53. designed these things had no thought to people wanting to use multiple
  54. languages.
  55.  
  56. What does this tell us?  That we are inventing the wheel all over again,
  57. that all the lessons painfully and expensively learned over thousands of
  58. man-years in the mainframe programming environment are being re-learned
  59. all over again, at significant expense, in the PC environment.
  60.  
  61. ---
  62. Paul Robinson -- TDARCOS@MCIMAIL.COM
  63. -- 
  64. Send compilers articles to compilers@iecc.cambridge.ma.us or
  65. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  66.