-===.- -
- - -
- - - - - - - - - - -
- - - - - - - - - - - --- - - - - - -
=====:"= . Application Program
CALL/360 - OS PL/I
System Manual - Volume I
Program Number 360A-CX-45X
The CALL/360-0S PL/I compiler (to be used with the CALL/360-0S system on an IBM System/360 Model 50 or higher) is described in the four volumes of this publication. The publication is addressed to system programmers and program systems representatives who require a detailed knowledge of the compiler. I t contains a
general overview of the compiler and detailed information on the compiler and runtime routines and macros that perform required functions.
Additional information required to und~rstand
CALL/360-0S PL/I compiler operations is provided in several appendices.
Volume I contains a general description of the compiler, a section on compiler operations, and a directory to compiler routines.
GY20-0567-1
PREFACE
This four-volume publication is addressed to system programmers and program systems representative who require a detailed knowledge of the CALL/360-0S PL/I compiler. It contains a general overview of the compiler and information on the compiler and runtime routines and macros that perform required functions.
Additional information required to understand CALL/360-0S PL/I compiler operations is provided in several appendices (see Volume IV). Appendix J contains tables of macro/module calls and summary listings of
CALL/36o-0S compiler and runtime routines, indicating where each routine is described in this publication.
The reader of this manual should have access to the CALL/360-0S PL/l Language Reference Manual (GB20-0100) and the CALL/360-0S Terminal Operations Manual (GB20-0181).
Terminal Equivalence
Terminals which are equivalent to those explicitly supported may also function satisfactorily. The customer is responsible for establishing equivalency. IBM assumes no responsibility for the impact that any changes to the IBM-supplied products or programs may have on such terminals.
second Edition (January 1911)
This edition, GY20-0561-1, is a major revision obsoleting GY20-0561-0.
It applies to Version 1, Modification Level 1, of CALL/360-0S and to all subsequent versions and modifications until otherwise indicated in new editions or Technical Newsletters.
Technical changes to text are indicated by vertical lines in the left margin. A revised illustration or chart is indicated by the symbol
• to the left of the caption.
Changes are continually made to the information herein. Therefore, before using this publication, consult the latest System/360 SRL
Newsletter (GN20-0360) for the editions that are applicable and current.
Copies of this and other IBM publications can be obtained through IBM branch offices. A form has been provided at the back of this
publication for readers' comments. If the form has been removed, address comments to: IBM Corporation, Technical Publications Department, 112 East Post Road, White Plains, New York 10601.
© Copyright International Business Machines corporation 1910, 1911
CONTENTS - VOLUME I
section 1 - General Description • Philosophy.
Objectives.
Facilities.
Approach.
Compiler organization • Data Organization • Naming Conventions.
Compiler Limitations.
Compiler-Time and Runtime Error Messages.
section 2 compiler Operations • Overview.
Phase 1 • Entokening.
General Statement Processing.
Declaration Processing.
Input/Output Statement Processing • Expression Processing •
Code Generation •
Phase 2 or wrap-Up Phase.
Support •
Executive Interface •
Section 3 - CALL/360-0S PL/I Compiler Routine Directory • Introduction.
Part 1 - Controllers.
Statement Category ($CATEG) Phase 1 Initializer ($CCONT).
Controller ($CNT)
Phase 2 Initializer ($WCONT).
Part 1 Logic Diagrams •
Chart 1. Statement Category ($CATEG) Chart 2. Phase 1 Initializer ($CCONT) Chart 3. Controller ($CNT)
Chart 4. Phase 2 Initializer ($WCONT) Part 2 - Entokening •
Increment Scan Index. ($ASIDX) Entoken ($ATKN. $ATKN2)
Search-Insert ($FIND) Get Non-Blank ($FNB).
Part 2 Logic Diagrams •
Chart 5. Increment Scan Index ($ASIDX) Chart 6. Entoken ($ATKN. $ATKN2)
Chart 1. Search-Insert ($FIND) Chart 8. Get Non-Blank ($FNB) Part 3 - General Statement Processors •
Assignment Generator ($ACGEN) PROC Generator ($APRC. $APRC2).
BEGIN Generator ($BEGIN).
On-Unit Specification Analyzer ($BONSA) GO Generator ($BRNB. $BRNB2).
CALL Generator ($CALL).
IF Generator ($CIF) ON Generator ($CON)
REVERT Generator ($CRVT).
STOP Generator ($CSTOP)
DO-Loop Triad Builder ($DEXP) DO Generator ($DOG. $DOG1).
RETURN Generator ($DRET).
END Generator ($EDGN, $EDGN2) Process End of ELSE ($ENDES).
i
1 1 1 2 2 4 1 10 10 10 12 12 12 13 14 15 11 23 29 33 35 36 31 31 31 38 39 41 43 45 45 46 41 53 54 55 56 59 61 62 62 63 12 14 15 16 11 19 80 81 83 84 85 81 88 89 92 93 94 96
Process End of ON ($ENDON) • • Expander ($EXPND) • • •
• • • • 97
• .. • ~ • • • • 98 END Expand ($EYFND) • • • • • • • • •
Part 3 Logic Diagrams • • • •
• • • • _ • 100 Chart 9. Assignment Generator ($ACGEN)
Chart 10. PROC Generator ($APRC, $APRC2) Chart 11. BEGIN Generator ($BEGIN) • • . 0 •
Chart 12. On-Unit Specification Analyzer ($BONSA) Chart 13. GO Generator ($BRNH, $BRNH2)
Chart 14. CALL Generator ($CALL) • Chart 15. IF Generator ($CIF) Chart 16. ON Generator ($CON) Chart 17. REVERT Generator ($CRVT)
Chart 18. STOP Generator ($CSTOP) • • . • • Chart 19. DO-LoOp Triad Builder ($DEXP) Chart 20. DO Generator ($DOG, $DOG2) • • • Chart 21. RETURN Generator ($DRET) • • • • Chart 22. END Generator ($EDGN, $EDGN2) Chart 23. Process End of ELSE ($ENDES) Chart 24. Process End of ON ($ENDON)
Chart 25. Expander ($EXPND) • ' • • • Chart 26. END Expand ($EYPND)
Part 4 - Declaration Processing • • Attribute Analysis ($ABAL) • • • • Attribute Node Creation ($ANCRE).
Label Processor ($BLPRC).
DCL Generator ($DCLGN) • • Locate Identifier ($FSYM) Locate Variable ($FVAR) •
Part 4 Logic Diagrams • • • • • • Chart 27. Attribute Analysis ($ABAL)
Chart 28. Attribute Node Creation <$ANCRE) Chart 29. Label Processor <$BLPRC) • •
Chart 30. DeL Generator ($DCLGN) • • • • • • • Chart 31. Locate Identifier ($FSYM) • • • • • Chart 32. Locate Variable ($FVAR)
Part 5 - I/O Statement Processing • GET Generator ($BGET) .••
PUT Generator ($BPUT) • • • Data Specification ($DDS) I/O Specification ($DIOS) O/C Specification ($DOCS)
Format List Generator ($FLG) • • • • • FORMAT Generator ($FMT) • • •
Format Item <$FORI, $FORI2) • • • • • . • Format in Data List Processor ($FPDL) OPEN/CLOSE Generator ($OPEN, $CLOSE).
Part 5 Logic Diagrams • • • • • • • .•
Chart 33. GET Generator ($BGET) Chart 34. PUT Generator ($BPUT)
Chart 35. Data Specification ($DDS) • • • • • Chart 36. I/O Specification ($DIOS)
Chart 37. o/C Specification ($DOCS) Chart 38. Format List Generator ($FLG) Chart 39. FORMAT Generator ($FMT)
Chart 40. Format Item ($FORI, $FORI2) • •
Chart 41. Format in Data List Processor ($FPDL) ••
Chart 42. OPEN/CLOSE Generator ($OPEN, $CLOSE) Part 6 - Expression Processing. • • • .• • • •
Argument Operand Processor ($NATTP) • • • Call Generator ($NCALL) • • • • • • • • • Cross-Section Dope Vector Build ($NCSDV).
Expression Processor Controller ($NEXP) Dimension Multiplier Generator ($NMULT)
Convert Operand ($NOPCV). • • • • • • • • Operator Stack Processor ($NOPRT) • • • • Operand Set-Up ($NPRE). • • • • • • • • •
• 101 101
• 102
• 105
• • • 106
• 108
• 110 112
• 113
• 115
• 116
• 117
• • • 119
• 123
• 124
• 130
• 131
• • • 132
• 133
• 134
• • • 135
• 137
• • • 140
• 141
• • • 143
• 144
• • • 146
• • • 146
• 148
· 158 061
· 162
· 163
• • • 166
· 167
• 11>9 171
· 173
· 174
• 175
• 178
• 179
• 180
· 181 183
• 183
· 185
• 187
• • • 193
• • • 195 197
• • • 202
• 203
• • • 205
• 206
• 207
• 208
• 209
• 211
• 213
• 217
• 218
• 220
• 223 Generate Triad ($TRIAD, $STRD) • • • • • _ • • • 224
Part 6 Logic Diagrams • • • • • • • • • • • • • • • • • Chart 43. Argument Operand Processor ($NATTP)
Chart 44. Call Generator ($NCALL) • • • • • _ • • • Chart 45. Cross-Section Dope Vector Build ($NCSDV) Chart 46. Expression Processor Controller ($NEXP) Chart 47. Dimension Multiplier Generator ($NMULT)
Chart 48. Convert Operand ($NOPcv) • • • • • • • • • .. • Chart 49. Operator Stack Processor ($NOPRT) • • • • • Chart 50. Operand Set-Up ($NPRE) • • • _ • • •
Chart 51. Generate Triad ($TRIAD, $STRD) • • • • • • • • Part 7 - Code Generator • • • • • • • • • • • • • •
optimize Operands ($OPMZO) • • • • • • • • • • • • String constant Dope Vector Initializer ($SCDV) • Triad Code Generator ($TCODE) • • • _. •
Triad Operand Processor ($TOPR) _ • • • Adcon Register Assignment ($VASGA) • • •
Computational Register Assignment ($VASGC) • • Register Table Initializer ($VCLR). .. • ... _.
storage Address Assembler ($VDSAC). .. _.
Temporary Storage Management ($VGTMP) • • • • • • Instruction Assembler ($VINSA) • • • • •
Part 7 Logic Diagrams • • • • • • • • • •
Chart 52. optimize Operands ($OPMZO) • • • • •
Chart 53. String Constant Dope Vector Initializer ($SCDV) Chart 54. Triad Code Generator ($TCODE) • • • • • • Chart 55. Triad Operand Processor ($TOPR) . • • • • • Chart 56. Adcon Register Assignment ($VASGA) • • • ..
Chart 57. Computational Register Assignment ($VASGC) Chart 58. Register Table Initializer ($VCLR) • • • • • • Chart 59. Storage Address Assembler ($VDSAC) • • .. • Chart 60. Temporary Storage Management ($VGTMP) • • • • Chart 61. Instruction Assembler ($VINSA) • • • • •
i i i
Chart 11. Segment Management ($WBACK) Chart 18. Segment Management ($WC'1'CT) Chart 19. segment Management ($WEXP) . . . Chart 80. segment Management ($WSTEP) Chart 81. Error Message Editor ($XERR) .. • Part 10 - Executive Interface • • • • .... _.
SVC Director ($SVC) • • • • • • • • • .. _.
Chart 82. SVC Director ($SVC) . . .
iv
. . . . . . .
• 1J41• 1J1J2
• 1J1I3
• IJIJIJ
• IJIJ5
• 1J50
• IJ50
• IJ51
FIGURES - VOLUME I
Figure 1-1. A Layout of Main Storage for
CALL/360-0S PL/I
· · · · · · · · · · · · · · ·
3Figure 1-2. Functional Organization of the CALL/360-0S
PL/I Compiler, Phase 1
· · · · · · · · · ·
6Figure 1-3. Functional Organization of the CALL/360-0S
PL/I Compiler II Phase 2
· ·
... 7Figure 1-4. Layouts of User Work Area. 9
Figure 2-1. Internal Compiler Logic. 12
Figure 2-2. The Entokening Process • 14
Figure 2-3. OPEN/CLOSE Processing.
'.
18Figure 2-4. GET/PUT Processing
· · ·
18Figure 2-5. Format List Processing.
· · '. ·
19Figure 2-6. Data-Directed I/O Flow of Control.
·
19Figure 2-7. List-Directed I/O Flow of Control.
·
20Figure 2-8. Edit-Directed I/O Flow of Control.
·
20Figure 2-9. Relationship of the Code Generated
for the Data List and Format List.
·
23Figure 2-10. Simplified Logic Diagram of the Expression
Processor Controller ($NEXP)
· · ·
24Figure 2-11. Simplified Logic Diagram of the Operator
Stack Processor ($NOPRT)
'. '.
25Figure 2-12. Expression Processor Tables.
· '. · · · · ·
29Figure 2-13. Code Generation.
· · · · · · · · · · · · ·
30Figure 2-14. Tables Used by $TCODE.
· · ,. · · · · · · ·
31Figure 2-15. Tables of Instruction Assembler ($VINSA) 32 Figure 2-16. Wrap-Up Routines
· · · · · ·
33Figure 2-17. Storage Allocation During compiler Wrap-up
· ·
34Figure 3-1. Figure 3-2. Figure 3-3. Attribute Conflict Matrix. Classification Masks Format List Generation Example
· '. · · · · · · · · · · · · · · · ·
136 137 176v
CONTENTS - VOLUME II
Section 4 - Runtime support Summary.
Library Interface Services (LIBINT).
I/O Management Package (IOMP) • • I/O Record Format. • • • • • Stream-Oriented I/O. • • • •
Handling of Interrupts Package CHIP)
Management of Object Program package (MOPP) • • Library Computational services (LIBCOMP) •
Total Conversion Package (TCP) • • • • • • Structure of Total Conversion Package.
Conversions - Type Arithmetic. • • String Manipulation package (SIMP) • Arithmetic Function package (AFUNC).
. .. . . . .
Definitions. • • • •
Module Description • • • • • • • • • • StlIlIIllary. • • • • • • • • • • • • •
Mathematical Function Package em-UNC). '. • Definitions. • • • •
Module Description • • • • • Summary. • • • • • •
Aggregate Manipulation Definitions. • • • • Module Description • summary • • • • • • •
Package (AMP)
Section 5 - Runtime Routine Directory.
I/O Management package • • • • • • • Close (IBECLOSE) • • • • • • • Data-Directed Input (IHEDDI) •
Data-Directed Output (IHEDDO).
.. .
Perform Calculation of the Subscript Values for an
Array Element CIHEDDP) • • • • • • • • • • • • • • • • • Edit I/O Director CIBEDIO) • • • • • • • • • • • •
List- or Edit-Directed GET Initiation and Termination (IHEIOA) • • • • • • • • • • ._ • • • • • • • • • • • output Initialization with or without Skipping (IHEIOB) • • Output Data to the Buffer Area and Communication with
CALL/360-0S (IHEIOD) • • • • • • • • • • • • Get Data Field from Input Buffer (IBEIOG) • • • Perform SKIP(w) Function for SYSPRINT (IHEIOP) Edited Horizontal Control Format Item (IBEIOX) List- and Data-Directed Input (IBELDI) • • • •
List-Directed output (IBELDO). • • • • • • • • • Open ( IBEOPEN) • • • • • • • • • • • • • • • • • Reset Disk Files (IHERSET) • • • • • • • • • •
Handling of Interrupts Package • Program Termination (IBEDUM) •
Table of Error Messages and Indicators (IHEERN) • • Error Routine (IHEERR) • • • • • • • •
On-ENDFILE and REVERT Initializer (IHEONREV) Management of Object Program Package • • • • • •
Output Director (IBEGPUT) • • • • • • • • • • • Initial Prologue, Expand DSA, End Prologue, Object
Program Initiation (IHESAD). • • • • • GO TO Interpreter (IHESAF) • • • • •
Library SVC Director (IHESVC) • • • • Total Conversion Package • • • • • • •
F/E-Format Input Director (IHEDIA) _ , A-Format Input Director (IHEDIB) •
C-Format Input Director (IBEDIM) • F/E-Format Output Director (IHEDOA).
A-Format output Director (IBEDOB) • • • • • •
. ."
1 1 1 2 3 6 1 8 8 11 13 18 19 20 21 24 26 21 21 32 35 36 36 38 39 39 40 41 43 45 41 48 49 50 52 53 54 56 58 59 60 62 63 64 65 68 69 10 11 13 14 15 16 18 80 82 84
C-Format output Director (IBEDOM) • • • •
Character string to Arithmetic (IREDCN) • • • • • • Arithmetic to Character String (IREDNC).
Zero Real or Imaginary Part (IREOPA) • •
Complex External to string Director (IREVCS) • Character String to Character string (IREVSC).
Arithmetic Conversion Director (IREDMA) • • • • Float Intermediate to Packed Decimal Intermedi~te
(IHEVFA) • • • • • • • • • • • • • • • • '. • • •
86 88 90 92 93 95 96
• • • • 99 Float Intermediate to Fixed Binary (IREVFB) • • • •
Float Intermediate to Float Short or Long (IREVFC) _ • • • • 100
• 101 Fixed Binary to ;!!.,f.oat Intermediate UREVFD) . . . . • • 102 Float SOurce to Float Intermediate (IREVFE) • • • •
Packed Decimal Intermediate to Float Intermediate (IBEVPA) • • • • • • • • • • • • • • • • • .. • • Packed Decimal Intermediate to F-Format (IREVPB) • Packed Decimal Intermediate to E-Format (IREVPC) • String with Format to Packed Decimal Intermediate
(IHEV'PE) • • • • • • • • • • • • • • • • • Table of Powers of Ten (IREVTB) • • • • Data Analysis Routine (IREVCA) • • .•
string Manipulation package. • • • • • Character String compare (IBECSC) • • Character String Assignment (IRECSM) Character String SOBSTR (IRECSS) Arithmetic Function Package. •
Speed. • • • . • • • • • • . . • • Accuracy • . • • • . • • • • • . . Ar<J1llDen ts. • • • • • • • • • • • • Binary Fixed Complex ASS (IBEASO).
Short Float Complex ASS (IBEABW) • • Long Float Complex ASS (IREABZ) • • Real Binary Fixed MAX/MIN (IREMXB) Real Short Float MAX/MIN (IBEMXS).
Real Long Float MAX/MIN (IREMXL) • Short Float Complex Division (IREDZW).
Long Float Complex Division (IBEnZZ) • •
. . .
Binary Fixed complex Mult/Div (IREMZU) • • • • • • Short Float Complex Mult (IBEMZW) • • • •
Long Float Complex Mult (IBEMZZ) • • • • Real Fixed Binary Integer EXP (IBEXIB) Real Short Float Integer EXP (IREXIS) • • Real Long Float Integer EXP (IREXIL) • • Z**N, Z Fixed Binary Complex (IBEXIO) • • • • Z**N, Z Short Float complex (IREXIW) • • Z**N, Z Long Float Complex (IREXIZ) • • • Short Float Real General EXP (IREXXS). .•
Long Float Real General EXP (IREXXL) • • Short Float Complex General EXP (IREXXW) Long Float complex General EXP (IHEXXZ).
vii
• • 103
• lOll 105
• 106
• • • • • • 107
• • • • • 108 109
• 110 111
• • • 113
• • • 115
• 116
• 116
• 116
• 117
• • • • • 118
• • • • • • 120
• • • • • • • • 122
• • • 1211
• 126
• 128
• • • • 130
• • • • • • • • 132
• • • • • 1311
• 136
• 137
• • 138
• • • • • 1110
• • • • • 1112
• • • • . • • • 144
• • • • • 1116
• • • • • 148
• • • 150
• • • 152
• 1511
• . . . , . • 156
FIGURES - VOLUME II
Figure 4-1. GET and PUT Compiled code Structure 4
Figure 4-2. Executable Format Scheme.
. · · · · · · · ·
5Figure 4-3. Modular Linkaqe throuqh Stream-Oriented I/O 6
Figure 4-4. changes of Data Type and Form
· · · · · · ·
9Figure 4-5. Total Conversion Package Structure.
• · · · · ·
12Figure 4-6. Arithmetic Conversion SUbpackage Structure.
'. · · · ·
13Figure 4-7. Flow throuqh Total Conversion Package
· · · · · ·
15Figure 4-8. Arithmetic Operations
· · · ·
24Figure 4-9. Arithmetic Functions.
· ·
24Figure 4-10. AFUNC Level 0
· · · · · · · · · · · · ·
25Figure 4-11. AFUNC Level 1
· · · .
25Figure 4-12. AFUNC Level 2
· · · · · · · ·
26Figure 4-13. Mathematical Built-In Functions
· · · ,. · · · · ·
29Figure 4-14. Mathematical Functions with Real Arguments.
·
32Figure 4-15. Mathematical Functions with Complex Arguments
·
32Figure 4-16. MFUNC Level 0
· · · · ·
33Figure 4-17. MFUNC Level 1
·
34Figure Figure 4-18. 4-19. MFUNC Level Array Indexers. 2
· · · · '. · · · · · · · · · · · · · ·
35 38Figure 4-20. Arithmetic Array Functions.
· · · · ·
38viii
CONTENTS - VOLUME III
Mathematical Function package. • •
Speed. . . • . . • • . . . . • . • • Accuracy • • • • • • • • • • •
Hexadecimal Truncation Errors. •
Hexadecimal Constants. • • • • • • • • Terminology. • • • • • • • • • • • • • • Arguments. . . • . • . • • • .
Short Float Real Arctan (IHEATS) • Long Float Real Arctan (IHEATL) • •
. . . . .
12 2 3 3 4 4 5 9 Short Float Real Hyperbolic Arctan (IHEHTS) • • • • • • 12 Long Float Real Hyperbolic Arctan (IHEHTL) • • • • • • • • • 14 Short Float Complex Arctan/Hyperbolic Arctan (IHEATW).
Long Float Complex Arctan/Hyperbolic Arctan (IHEATZ) • • • •
Short Float Real Error Function (IHEEFS) • • • • • • • • Long Float Real Error Function (IHEEFL). • • • • Short Float Real EXP (IHEEXS). • • • • • • • Long Float Real EXP (IHEEXL) • • •
16 19 22 25 28 30
Short Float Complex EXP (IHEEXW) • • • • 32
Long Float Complex EXP (IHEEXZ) • • • . • • . • 34 Short Float Real Log (IHELNS) • • •
· . .-
36Long Float Real Log (IHELNL) • • • • • • • 39
Short Float Complex Log (IHELNW) • • • • 42
Long Float Complex Log (IHELNZ) • • • • • • • 44 Short Float Real Sin/Cos (IHESNS) • • • • • •
Long Float Real Sin/Cos (IHESNL) • •
• • • . . . • . 46
• • • • 49 Short Float Real Hyperbolic Sin/Cos (IHESHS) • • • • 52 Long Float Real Hyperbolic Sin/Cos (IHESHL). • • • • • • • • 54 Short Float Complex Sin/Cos (IHESNW) • • • • • • • • • • 57
• • • • 60 Long Float Complex Sin/Cos (IHESNZ).
Short Float Real SQRT (IHESQS) • • • Long Float Real SQRT (IHESQL) • • • • Short Float complex SQRT (IHESQW).
• • • • • • • • • • • 63
Long Float Complex SQRT (IHESQZ) • Short Float Real Tan (IHETNS) • • •
Long Float Real Tan (IHETNL) • • • • • • • • Short Float Real Hyperbolic Tan (IHETHS) Long Float Real Hyperbolic Tan (IHETHL) • • •
Short Float Complex Tan/Hyperbolic Tan (IHETNW) • • Long Float complex Tan/Hyperbolic Tan (IHETNZ)
Aggregate Manipulation Package • • • • • • • • • • • • • Speed. . . . • . . . • . . . . . . . • . Effect of Hexadecimal Truncation •
Arguments. • • • • • • • • • • • • • • • • Interleaved Array Indexer (IHEJXI)
• • • • 66
• • • • 68
• • • • 70 72 75
• • • • 78
• • • • 80
• • • • 82 84
• • • • 87
• • • • 87 87
• • • • 87
• • • • 89
• • • • 91 93
• • • • 95
• • • • 97
• • • • 99
• 101
• 103
• • • • 105
• 107 PROD-Interleaved Real Fixed Array (IHEPDF)
PROD-Interleaved Real Short Float Array (IHEPDS) PROD-Interleaved Real Long Float Array (IHEPDL) • • PROD-Interleaved Complex Fixed Array (IHEPDX). • • • PROD-Interleaved Complex Short Float Array (IHEPDW) • • PROD-Interleaved Complex Long Float Array (IHEPDZ) • • SUM-Interleaved Real Fixed Array (IHESMF) • • • • • • • SUM-Interleaved Real/Complex Short Float Array (IHESMG) • • SUM-Interleaved Real/Complex Long Float Array (IHESMH)
SUM-Interleaved Complex Fixed Array (IHESMX) • • • • • . • 109 POLY (A,X) (A and X Real Fixed) (IHEYGF) • • •
POLY (A,X) (A and X Real Short Float) (IHEYGS) POLY (A,X) (A and X Real Long Float) (IHEYGL).
POLY (A,X) (A and X Complex Fixed) (IHEYGX) • • POLY (A,X) (A and X Complex Short Float) (IHEYGW).
POLY (A,X) (A and X complex Long Float) (IHEYGZ) •
ix
• 111
• • • 114
• 117
• • • • • • 120
• 123
• • 126
CONTENTS - VOLUME IV
Appendix A - Compiler Conventions and Data Layout. • Naming and Usage • • • • • • • • • • •
Registers. . . . . . . . Subroutines. • • • • • • • • • • • • •
Register Save-Areas. • • • Compiler-Wide Variables.
compiler Tables and Lists.
Symbolic organization. • • • • • • • • • • • • • • • • • • Runtime Routine structure~
compiler Variables • • • • • • • •
C-Area • • • • • • •
P-Area G-Area • •
Appendix B - compiler Tables and Lists • General. • • • • • _ • •
Dictionary Attribute List (A List) • • • • • • • • Block Information Table (B Table).
Constant Table (C Table) • • • • • Line Number Table (D Table) • • • Dictionary Hash Table (H Table) • • • Initialization Table (I Table) • • • •
Dope Vector List (J List) • • • • • • • • • • • • • • Library Load Table (L Table) • • • • • • • • • • Symbolic Instruction Table (M Table) • • • • • • Dictionary Name List (N List) • • • •
Operation Code Table (0 Table) • • •
Program Structure Table (P Table). • • • • • • •
Subscript Substitution Table (Q Table) • • • • • • • • • • • • • • Register Table (R Table) • • • • • • • • • • • • • • Temporary Storage Table (S Table). • • • • • • • • • • Token Table (T Table). • • • • • • • • • • • • • • • • • Expression Stack (V Table) • • • • • • • • • •
Operator Stack (X Table) • • • • • • • • • • • • • • • • • • Operand Stack (Y Table). • • • • • . • • • Triad Table (Z Table). • • • • • • • • • • Dope Vector Table. • • • • • • • • • • ENDFILE Table. • • • • • • • •
Entry Name Declaration List. • • • • • • • • • •
On-Unit Parameter List • • • • • • • • • • • • • • • • • • • • Routine Entry Name Processed Table •
Appendix C - compiler Support Macros • • Table Handling Macros. • • • •
Expandable Tables. • • • • Lists. • • • • • • • • • • • Delete Entry Macro (DNODE) • Free Area Macro (FAREA) • • •
Current Entry Locator Macro (GCURR) • • • • • • Pointer to First Node Macro (GFRST).
Get Next Entry Macro (GNEXT) • • • Get Node Macro (GNODE) • • • • • • Get Previous Entry Macro (GPREV) • Insert Entry Macro (INODE) • • • • Establish Pointer Macro (MNODE) • • Other Macros • • • • • • • • • • • • • • •
Subroutine Call Macro (CALL) SVC Interface Macro (CSVC) • • DED Macro (DED) • • • • • • • •
Expression Processor Call Macro (EXFG) • • • • Forward Internal Branch Macro (FIB) • • • Error Interface Macro (GENER).
Get Token Macro (GETKN) • • • • • • •
1 1 1 2 2 2 2 3 3 5 5 6 6
17 17 18 29 31 33 34 35 38 39 40 42 45 47 51 52 57 58 61 62 64 66 70 71 72 73 74 75 75 75 77 79 80 81 82 83 84 85 86 87 88 88 89 90 91 92 93 94
Generate Triad Macro (GTRD) • • • • • • • Syabolic IDStructi.on rab1e Macro UIlBT}.
..AIiIeoD. GeD.erat:iClD IlaCEO ~ _ _ .. _ _ _ • _ _ .. _ Reso1'Ve I!OnJarcl Int:erDa1 BraDCh Tri.aiI JIaen) UIF.IBJ
Skip Token Macro (SKPTK) • • • • • •
Symbol Definition Macro (SYMDEF) • • • • • • • Tally Macro (TALLY) • • • • • •
Entokening and GENER Interface Macro (TGENER).
Appendix D - Runtime Support Macros. •
General. . . . . . . . .
Naming conventions • • • • •
storage Requirements and Library Address constants
95 96 97 98 99
• 100
• 101
• • • • 102
• 103
• 103
• 10"
• • • 10"
Data Representation. • • • • • • • • • • • • • • • 106 The Library Work Space • • • • • • • • • •
Relocatable Work Area (LWSP) • •
Non-Relocatable Work Area (LWS) • • • • • Registers and Offsets. • • • • • • • Library support Macros • • •
• • • • 107
• 107 109
• • 110
• 111 Call Error Macro (CALLERR) • • • • • • • • • • • • • •
CALL/36o-0S Macro (CALRTS) • • 112
• 113 Check FCB Macro (CKFCB) • • • •
Address Constants Macro (IHEADC) • • • • • • • • • Branch Macro (IHEBRA) • • • • • • • •
BAA EXtern Macro (IBEBXT) • • • • • • • • Call Macro (IBECAL) • • • • • • • • • • • Double Cover Macro (IBEDCV) • •
Difference Macro (IBEDIF) • • ERRCD Macro (IHEERRCD) • • •
Initialize File Control Block Macro (IHEFCB)
Save FCB Pointers Macro (IHEFCIB). • • • • • Link Routine Macro (IHEFROM) •
External Macro (IHEEXT) • • • • Header Macro (IBEBDR) • • • • • I/O Interface Macro (IBEIOD)
Standard Offsets Macro (IHELBE) • •
Library Macro (IBELIB) • • • • • • • • • • • • • • Library Work spac~ Macro (IHELWS).
• • • • 11"
• • • • • • • • 115
• • • • • 116
• • • • 117
• 118
• • • • • • • • 119 120
• • 121
• 122
• 123
• 12"
• 125
• • • • 126
• 127
• • • • 128
• 129
• 130
• • • 131 MOPP Macro (IHEMOPP) • • • •
Name Macro (IHENAME) • • • • Open Test Macro (IBEOPENT) • Patch Macro (IBEPCH) •
• • • • • • • • • • • • • • • • 132
• • • • • • • • 133 Return Macro (IBERET) • • • • • • •
Restore Macro (IBERST) • Save Macro (IBESAV) • • • • • Single Cover Macro (IHESCV).
SDR Macro (IHESDR) • • Symbol Macro (IBESYM).
Trailer Macro (IHETLR) Zap Macro (IBEZAP) • • •
Library Definition Macro (LIBDEF) • • • Read Disk Macro (READDISK) • • • •
. . ..
• • 13"• • • • 135
• • • • 136 137
• • • • 138
• 139
• 1"0
• 1"1
• 1"2
• 1"3
• 1"5 Read Term Macro (READTERM) • • • • •
Uniform Interface for SVC Macro (RTSSVC) Set Disk Macro (SETDISK) • • • • •
. • • . . • • • . • . • . 146
Set Error Code Macro (SETERRCD) • • • • • • Set File Controls Macro (SETFLCA).
Set Dope Vector Macro (SETSDV)
Appendix E - Object code Storage Layout • • Object Code. • • • • • • • • • • •
Symbol Tabl e • • • • • • • • • • • • • Object Code Address-Line Number Table • • static and Constants storage • • • • • •
Data Element Descriptor (DED) • • •
The P Byte • • • • • • • • • • • • • . • • • • • The Q Byte • • • • • • • • • • •
Format Element Descriptor (FED) • •
xi
• 1"7
• 1"8
• 1"9
• 150
• • • • 151
• 152
• • • • 152
• • • • 152
• • • 153
• 15"
• 155
• 155
• 156
• 156
Dope Vectors • • • • • • • String Dope Vector (SDV) Array Dope Vector (ADV) • •
String Array Dope Vector (SADV) • • Address constant Area. •
Multi-File Interface • Communications Area.
static and Constants Area. •
FCIB Offsets and FCIB"s for SYSIN and SYSPRINT • FCIB"s for Disk Files. • • • • • • •
Adcon Area (Fixed-Length Portion) • • • Common Data Specification Portion of FCB Block Adcon Area • • • • • •
On-Unit Adcon Area • • • • • • • • • • • • Library. " . . . .
Static Array and String Storage. • • • • • Dynamic Storage Areas and ON-Conditions. • • • • • •
Examples • • • • • • • • • • • • • • •
Data Addressing. • • • • • • • • • • • • • • • • • •
• 156
• 156
• 151
• 159
• • 159
· 162
• 162
· 162
• 162
• 163
• 164
• • 165
• 161
• • • • 168
• • 110
• • • • 170
• 110
• 113
• • • • 116 Appendix F - Support Services for Language Processors. • • • • • 178 compiler/Executive Interactions. • • • • • • • • • • • • • • 179 Storage Allocation. • • • • • • • • • • 119 Initial Register Settings. • • • • • • '. • 119 User Work Area • • • • • • • • • • • • • • 180
User Terminal Table. • • • 181
Addressing • • • • • • • • • • • • 181
I/O Processing • • • • • • • • 181
Terminal I/O • • • • • • • • • • • • • • • • • • • 181 Disk I/O • • • • • • • • • • • • • • 182 Interrupt Handling • • • • • • • • • • • • • • • • • 183 swap-Inhibited situations. • • • • • • • • • 183 End of Compilation • • • • • • • • • • • • • • • 184
Detailed Format Descriptions • • • • • . 184
communications Area. • • • • • 184
UTT Data Available to Language Processor • • • • • • 186 Data File Table. • • • • • • • • • • • • • • • . 181
Output Buffer Format • • • • • • • • 189
Format of Date Information. • • • • • • • • • • 190 supervisor call (SVC) Instruction. • • • • • • • 190 Appendix G - CALL/360-0S PL/I Compiler Maintenance •
Module Storage • • • • • Update and Assembly. • • Link Edit. • . • • • • •
CALL/360-0S PL/I Member Names.
compilation Member Names • • • • • • • • Runtime Member Names • • • • •
Appendix H - Diagnostic Messages • • Compilation Error Messages • •
Execution Error Messages • •
Appendix I - Maximum Size of Source Proqraro. • Storage Required at Input of Program •
Storage Required to Compile Program.
Storage Required to Execute Program. • • • • . Examples • • • •
Example 1. • Example 2. • • • Example 3. • •
Appendix J - Reference Listings.
CALL/360-0S PL/I Compiler Subroutines.
CALL/36o-0S PL/I Runtime Library Macro-Macro Cross Reference. • Module-Macro Cross Reference •
Module-Module Cross Reference • • • • • .
xii
• 194
· • 194
• 194
• 195
· 196
• 196
• 196 198
• • • • 198
• 202
• 206
• 206
• 206
· 206
• 201
• 207
• 208
• 208
· 209
• 209
• 215 227
· 228
• • • • 234
FIGURES - VOLUME IV
Figure E-1.
Figure B-2.
Figure B-3.
Figure B-4.
Figure B-5.
l"igure B-ob.
Figure B-7.
Figure B-8.
Figure B-9.
Figure B-l0.
Figure B-1L Figure D-l.
Figure D-2.
Figure D-3.
F'igure E-l.
Figure E-2.
Figure E-3.
Figure E-4.
Figure E-5.
Figure E-6.
Figure E-7.
Figure E-8.
Figure E-9.
Figure E-l0.
Figure E-l1.
Figure E-12.
Figure E-13.
Figure E-14.
Figure E-15.
Figure E-16.
Figure E-17.
Figure "E-18.
Figure E-19.
Figure E-20.
Figure E- 2:L.
Figure E-22.
Figure E-23.
Figure E-24.
Figure E-25.
Figure E-26.
Figure F-l.
Figure F-2.
Figure J-l.
Figure J-2.
Figure J-3.
Figure J-4.
Dic-tionary Attribute Entry--First 13 Bytes. . . • 18 Dictionary Attribute Entry for Nonlabel VariablE". 20 Dictionary Attribute Entry for Label Variable . 21 Dictionary At-t.ribute Entry :for Statement-Label
COT1stant. • • • • • • • .. • • • • • • • .. • . . Dictionary Attribute En-try for Entry Name . . . Dictionary Attribute Entry for Built-In Funct!on Entry Name. • • • • • .. • .. • • • • ... • . . • Dictionary Attribute Entzy for Filename • Dictionary Attribute Ent ry for a constant • . Operand Values for Symbolic Instrnc-::ioTl Tablp Format of Register Table.
Format of Token Table • • • • • • • • •
22 23 23 26 28 41 53 58 CALL/360-0S PL/I Address constants Area • • • • • 105 CALLI'360-0S PL/I Data Representation. • • • • • • • • 107 LIBDEF Call s. • • • • • • • • • • • • • . • • • • 144 Symbol Table Entry. • • • • • • • • 153 Objec-t Code Address-Line Number Entry • • • • • 153 Static and Constants Area • • • • • • • • 15q DED Formats • • • • • • • • • • 155 Definition of DED Flag Field IK9DDFF) . • • 155
SDV Forma-t. • 157
ADV Format. • • • • • • • • • • • 158 SADV Format • • • • • • • • • . • • 159 Layout of Fixed-Length Portion of Adcon Area. • • 160 Communications Area • • • • • • • • • . • 162 FCIB Offsets and FClB's for SYSIN and SYSPRINT . • • • 163 FCIB Format for Disk Files. • • • • • • • . • 163 FCB Format in Fixed Adcon Area. • • • • • • • 164 Cornman Data Specification "Portion of FCB for Dat_a
Input and Non-.~ray Element Data output • • . . • • 165 Common Data Specification Portion of FCR fOT Array
Element Data Output • • • • • • • • • • • • • • • • • 165 Common Data Specification Portion of FCB for
Initialize output with SKIP Option. • • • • • . • • 166 Common Data specification Portion of FCB for List
I/O • • • • • • • • • • • • • • • • • • • • • . • • 160
· 166 Common Data Specification Portion of FCB for Non-
Complex Edit 11'0. • • • • • • • • • • • • • . • Common Data Specification Portion of FeB for Complex Edit I/O. • • • • • • • • • • • • • • Format of Block Adcon Area (BAll). • • • • •
Format of on-Unl. t Adcon Area. (Excep-t for ON
• 167
• . • 168 ErIDFILE). . • .. . • • .. • • • .. • . . . • •
Format of ON ENDFlLE Adcon Area • . • . • • • Layout of DSA for Internal Procedure and Beqin Blocks. • • • • • • • • • . _ • • • • . Layout of DSA for On-Units (Except ON ENDFILE) . • Layout of DSA for ON ENDFILE On-Units •
General Purpose Register Assignment • Format of CALL/360-0S SOurce Lines . . Referencing Data File Tables • • . Macro-Macro Cross Reference • • •
Compilation Modul~-Macro Cross Reference.
Runtime Module-Macro Cross Reference. • • Compilation Module-Module Cross Reference •
xiii
• 169
• 170
· 172
• • 173
• 173
• 176
• 180
· 188
• 227
• 229
• 231
• 235
SECTION 1 - GENERAL DESCRIPTION
The CALL/360-0S PL/I compiler (to be used with the CALL/360-0S system on an IBM System/360 Model 50 or higher) is described in this manual.
The compiler accepts, as input, a complete source program written in the CALL/360-0S PL/I language. The language (described in the CALL/360- OS PL/I Language Reference Manual) is oriented to a scientific user.
It was selected on the basis of its utility to such a user, as well as the ease with which i t could be implemented. The compiler produces a machine-language (object) program directly into memory and, if no severe errors were detected during compilation, initiates execution of the program.
This section of the manual presents the CALL/360-0S PL/I compiler as a whole and presents the overall logic of its implementation. It is intended for a reader having some knowledge of the time-sharing system under which i t will run and of the CALL/360-OS PL/I language.
Furthermore, i t is designed for a reader who desires a broad picture of the design of the compiler.
PHILOSOPHY
The CALL/360-0S System is designed to support a large number of users concurrently interacting with the computer through typewriter-like
input/output terminals. Since each user is in effect conversing with the system, a basic requirement is that the system respond within a reasonable time. In order to support these users with a limited amount of high-speed computer memory, some of the modules are stored
temporarily in online storage units (disks) and called in for execution as needed. Since the number of modules that can be contained in high- speed storage at anyone time is dependent upon their sizes, they should be as small as possible. compiler modules that are loaded from disk for execution will not always be loaded to the same core location;
therefore, they must be dynamically relocatable.
While the terminal user is entering his source text into the computer, he is in communication with the CALL/360-OS Executive (not with the compiler). After the complete text has been entered and the user has requested that the program be executed, the compiler is invoked. Once invoked, the compiler processes the complete source text, generating the object code into an area of memory allocated by the Executive.
OBJECTIVES
The compiler is designed to achieve the following goals:
1. To be as small as possible.
2. To be as fast as possible.
3. To provide a compilation facility for the CALL/360-0S PL/I language, with good diagnostic capability.
4. To produce efficient object code.
To a certain extent, these goals are mutually exclusive. A small, fast compiler is usually not able to produce efficient object code.
Also, the extent of the language facilities supported by a small, fast compiler is usually very limited. The design of the CALL/360-0S PL/I
1
compiler gives first priority to objectives 1 and 2, and secondary priority to objective 3. I t strives for the best possible attainment of objective 4 within these constraints.
FACILITIES
The CALL/360-OS PL/I compiler operates in conjunction with and is
controlled by the CALL/360-OS Executive. When the compiler is invoked, i t processes and translates a CALL/360-0S PL/I source program directly into machine-readable object code (in main storage). The compiler does not produce a binary deck or any hard copy listings of the
generated object code. Nor is i t possible to save or store the compiled code immediately after compilation. Compilation and execution are
invoked simultaneously (unless severe errors cause cessation of processing).
The command that the user must give to initiate both compilation and
-
execution is the CALL/360-0S system command RUN. (See the CALL/360-0S Terminal Operations Manual, Form Number GB2o-0181.) This command initiates a sort, i f necessary, followed by compilation and execution of the user program. After being invoked, the CALL/360-0S PL/I compiler provides diagnostic messages on the user terminal for any errors detected during compilation. (See ·Compiler-Time and Runtime Error Messages· in this section and Appendix F of the CALL/360-0S PL/I Language Reference Manual, Form Number GH20-0100.) When compilation and execution have been
completed or terminated because of an error condition, the user can utilize available editing facilities to correct his program if necessary. Then he can enter another RUN command to recompile and reexecute his program.
A user's program consists of a single external procedure and the runtime library routines needed to support i t . Although the external procedure may contain internal procedures, there are no facilities for linking separately compiled external procedures.
In addition to the compiler itself, a package of library routines is provided to support the object program at execution time. These routines are described more fully in later sections of this manual.
APPROACH
To meet the primary objectives of m1n1mum size and maximum speed, the CALL/360-oS PL/I compiler has been designed to translate a CALL/360- OS PL/I source program in one pass over the source statements. That is, code is generated for each statement at the time and in the order i t is encountered in the source stream. This does not prevent ~he
compiler from scanning a statement several times during the compilation, but each statement is fully processed before processing of the next statement is begun.
One phase of the compiler, the source text, and the target area for the object program are completely contained in core memory during a compilation. None of these areas is overlaid. This approach places a practical limitation on the size of the program that can be compiled but avoids the necessity to include costly spill and overlay logic
in the compiler. .
The compiler itself is both reenterable and relocatable. These
characteristics are necessary because CALL/360-0S, in essence, performs multiprocessing within its own partition in addition to handling and servicing interrupts and commands from any of a number of terminals.
2
Main storage is allocated for all of the resident modules and
subroutines. I/O appendages, tables, CPID (control program interrupt dispatcher). an overlay buffer for nonresident modules. terminal and disk I/O buffers. compiler area, new-job-area-1, new-job-area-2
(optional), old-job-area, and any necessary 05/360 control blocks.
At any given time, a number of user jobs may be in process.
Furthermore, these jobs may require different compilers (in which case.
one compiler may be overlaid by another compiler). Typical organization of main storage when the CALL/360-05 PL/I compiler has been invoked is shown schematically in Figure 1-1. In this example, a computer having 512K of main storage is assumed.
~---
- - - -
OS/360 CONTROL BWCKS __ _ ---- - - -
OLD JOB AREA
~--- --- - - - -
1 - - - -- -- - --- -- ---
f - - - -
NEW JOB AREA 2
NEW JOB AREA I
--- --
---
CALL/360-0S PL/I COMPILER
-- ---~--- -
UTrs AND OVERLA Y BUFFER TABLES AND 20-0YTE I/O BUFFERS
CALL/_160-0S MODULES -\ND SIJBROUTINE~
"'
- --
- - - -
1{0 APPENDAGES CPID
--- -1
---.---~ I
Figure 1-1. A Layout of Main Storage for CALL/360-0S PL/I
1