• Aucun résultat trouvé

Compiler Listing

Dans le document OS PL/I (Page 47-54)

During compilation, the ccrrpller generates a listing, most of which is optional, that contains inforrration about the source program, the compilation, and the object

Of course, if compilation terminates before reaching a particular stage cf

processing, the corresponding listings will not appear. specified in the MSGLEVEL parameter.

The listing comprises a small amount of standard inforrr.ation that always appears, together with those items of opticnal information specified or supplied by default. The listing at the terrrinal

contains only the optional information that has been requested in the TERMINAL cption.

34 OS PL/I Optimizing Compiler: programmer's Guide

r---, I

Listings

I

Options required

Options used for the compilation OPTIONS

Preprocessor input MACRO and INSOURCE

Source program SOURCE

Statement nesting level NEST

Attribute table ATTRIBUTES

Cross-reference table XREF

Aggregate length table AGGREGATE

Storage requirements STORAGE

Statement offset addresses SOURCE, OFFSET, NOSTMT

External symbol dictionary ESD

Static internal storage map MAP

Object listing LIST

Messages FLAG

L---__________________ ---J

Figure 4-7. Comfiler listings and associated options HEADING INFORMATION

The first page of the listing is identified by the name of the compiler, the corrpiler version number, the time compilation commenced (if the system has the tirrer feature), and the date; this page, and subsequent pages are numbered.

The listing either ends with a statement that no errors or warning conditions were detected during the compilation, cr with one or more messages. The format of the messages is described under "Messages,"

later in this chapter. If the machine has the timer feature, the listing also ends wi th a statement of the CPU time taken for the compilation and the elapsed time during the compilation; these times will differ only in a multiprogramming environrrent.

The following paragraphs descrire the optional parts of the listing in the order in which they appear.

OPTIONS USED FOR THE COMPILATION

If the option OPTIONS applies, a complete list of the options used for the

compilation, including the default options, appears on the first page.

PREPROCESSOR INPUT

If both the options MACRO and INSCURCE apply, the input to the preprocessor is listed, one record per line, each line

numbered sequentially at the left.

If the preprocessor detects an error. or the possibility of an error, i t prints a message on the page or pages following the input listing. The fern-at cf these

messages is exactly as described for the compiler messages described under

"Messages," later in this chapter.

SOURCE PROGRAM

If the option SCURCE apf1ies, the input to the compiler is listed, one record per line; if the input records ccntain printer control characters or ~SRIP or %PAGE

statements, the lines will re spaced accordingly.

If the option NUMBER applies, and the source program contains line numbers, these numbers are printed tc the left cf each line.

If the option STMT applies" the statements in the source frcgrarr are

nurrbered sequentially ry the compiler, and the number of the first staten,ent in the

line appears to the left of each line in which a statement begins. when an END statement closes more than one group or block, all the implied END statenents are included in the count. For example:

1 P: the preprocessor, columns 73-80 contain diagnostic information, as shown in Figure 4- 8. generated. This number

corresponds to the line number has occurred while replacement is being attempted. If no error has occurred, the column is blank.

Figure 4-8. Contents of columns 73 to 80 of source statements

STATEMENT NESTING LEVEL

If the option NEST applies, the block level

ATTRIBUTE AND CROSS-REFERENCE TABLE If the option ATTRIEUTES a:t:r:lies, the compiler prints an attrirute table

containing a list of the identifiers in the source :t:rogram together with their declared and default attributes. In this context, the attributes include any relevant options, such as REFER, and also descriptive comments, such as:

/ *STRUCTURE */

If the o:t:tion XREF applies, the compiler prints a cross-reference tarle containing a

list of the identifiers in the source indicated by asterisks. The statement numbers of statement labels and entry labels are also given.

The attributes INTERNAL and REAL are never included; they can be assumed unless the respective conflicting attributes, EXTERNAL and COMPLEX, a:t:pear.

For a file identifier, the attritute FILE always appears, and the attribute EXTERNAL appears if i t a:t:plies: otherwise, only explicitly declared attributes are listed.

For an array, the dimension attribute is printed first; the bounds are :t:rinted as in the array declaration, rut expressicns are replaced by asterisks and structure levels other than base elenents have their tounds replaced by asterisks.

For a character string or a bit string, the length, preceded by the word BI~ or CHARACTER, is printed as in the

declaration, but an expressicn is rer:laced by an asterisk.

of a statement in which an implicitly-pOinter qualified based variable appears will be included not only in the list of statement numbers for that variable, but also in the l i s t of statement numbers for the pointer associated with i t implicitly.

I If a based variable is referenced Iwithout explicit pointer qualification, a Ireference to the implicit pOinter used will lbe included in the cross-reference listing.

Note that an END sta tement that refers to a label does not have its statement number listed in the entry for the label.

Identifiers that are initialized during execution of prologue code on entry to a block will have the PROCEDURE or BEGIN statement number included in the list of statement numbers. For example, automatic variables with the INITIAL attribute in a single-block program will .have a reference to statement number 1 in the

cross-reference table.

The order in which the statement numbers appear for a particular identifier is

subject to any reordering of blocks that has occurred during compilation. In general, the statement numbers for the outermost block are given first, followed on ·the next line by the statement numbers for the inner blocks.

I The PLII text is expanded to a certain lextent before the cross-reference list is Iproduced. Consequently, an identifier Iwithin a statement may acquire multiple Ireferences to the same statement number.

ICommon examples are the use of do-groups land statements involving aggregates.

AGGREGATE LENGTH TABLE

An aggregate length table is obtained by aggregate is declared.

• The name of the aggregate and the element within the aggregate.

• The level number of each item in a structure and sub-structure.

I If there is padding between twc

Istructure elements, a /*PADDING*/ comment lappears, with appropriate diagnostic I information.

The table is completed with the sum of the lengths of all aggregates that do not contain adjustable elenents.

The statement or line number identifies either the DECLARE statenent for the

aggregate, or, for a controlled aggregate, an ALLOCATE statenent fer the aggregate.

An entry appears for each ALLOCATE

statement involving a controlled aggregate, as such statements can have the effect of changing the length of the aggregate during execution. Allocation of a based aggregate does not have this effect, and only one entry, which is that correspcnding tc the DECLARE statement, appears.

The length of an aggregate may not be known during compilaticn, either because the aggregate contains elements having adjustable lengths or dinensions, cr because the aggregate is dynamically defined. In these cases, the word

"adjustable" or "defined" appears in the

"length in bytes" column. lists the following information under the heading "Storage Requirenents" on the page

following the end of the aggregate length control section. This control section contains all storage for variables declared STATIC INTERNAL.

STATEMENT OFFSET ADDRESSES

If the option OFFSET applies, the compiler lists, for each primary entry point, the offsets at which staterpents occur. This information is found, under the heading

"Table of Offsets and Statement Numbers,"

following the end of the storage

Note the corresponding statement or line number.

EXTERNAL SYMBCL DICTIONARY

If the o~tion ESD applies, the ccrr~iler identifies the external symbol. control secticn that contains no data or the task ccnrrunications area (TCA), used by the comFiler and by the library subroutines for handling files and con-trolled variables.

LD Label definition: the name of an entry Fcint to the external procedure other than that used as the name of the program control secticn.

Four-digit hexadecirral number:

all entries in the ESD, except LD-type entries, arenurrbered sequentially, commencing from 0001.

38 OS PL/I Optimizing Compiler: Programmer's Guide

AOOR Hexadecimal representation of

The external symbol dictionary always

starts with the following standard entries;

the entries for an external procedure with the label NAME are shown in Figure 4-9.

• sD-type entry for PLISTART. This

control section transfers control to the initialization routine IBMBPIR. When initialization is complete, control passes to the address stored in the control section PLIMAIN.

(Initialization is required only once during the execution of a PL/I program, even if i t calls another external procedure; in such a case, control

passes directly to the entry point named in the CALL statement, and not to the address contained in PLIMAIN.)

r---,

I I I

EXTERNAL SYMBOL DICTIONARY I SYMBOL TYPE 10 ADDR

contains the executable instructions of the object module). This name is the control section (which contains main storage for all variables declared

sutroutine that handles program

initialization and terrrinatien.

Other ESO Entries

The rema1n1ng entries in the external symbol dictionary vary, but generally include the following:

• SO-type entry for the 4-byte control section PLIMAIN, which contains the address of the prirrary entry point to the external procedure. ~his control

section is present only if the prccedure statement includes the option MAIN.

• Weak external reference to PLITAES, a library subroutine that ccntains the standard or locally-defined tab setting for stream-oriented output.

• LD-type entries for all names of entry points to the external prccedure.

• A PR-type entry for each tlock in compilat ion.

• ER-type entries for all the library sutroutines and external procedures called ty the source program. This list includes the names of resident library subroutines called directly by compiled code (first-level subroutines), and the names of other resident library

subroutines that are called by the first-level subroutines.

• CM-type entries for non-string element variables declared STATIC EXTERNAL without the INITIAL attritute.

• SD-type entries for all other STATIC variatles. For external variables, the name of the variable is used fer the

pseudo-register name; for internal

variables, the compiler generates narres.

STATIC INTERNAL STORAGE MAP

If the option MAP applies, the compiler generates a listing of the contents of the static internal control section; this listing is termed the static internal storage map.

'I'he MAP option also produces a Variable storage Map. This map shows how PL/I data items are mapped in main storage. It names

each PL/I identifier, its level, its offset from the start of the storage area in both decimal and hexadecimal form, its storage class, and the name of the PL/I block in which i t is declared.

OBJECT LISTING

If the option LIST applies, the ccmpiler generates a listing of the machine

instructions of the object module, including any compiler-generated subroutines, in a form similar to IBM system/360 assembler language.

Both the static internal storage map and the object listing contain information that cannot be fully understood without a

knowledge of the structure of the obj ect module. This is beyond the scope of this manual, but a full description of the object module, the static internal storage map, and the object listing can be found in OS PL/I Optimizing Compiler: Execution Logic.

MESSAGES

If the preprocessor or the compiler detects an error, or the possibility of an error, they genezate messages. Messages generated by the preprocessor appear in the listing immediately after the listing of the statements processed by the preprccessor.

Messages generated by the compiler appear at the end of the listing. All messages are graded according to their severity, as follows:

• An informatory (I) message calls

attention to a possible inefficiency in the program or gives other information generated by the compiler that may be of interest to the programmer.

• A warning (W) message calls attention to

a possible error, although the statement to which i t refers is syntactically valid.

• An error (E) message describes an error detected by the compiler for which the compiler has applied a "fix-up" with confidence. The resulting program will execute and will prcbably give ccrrect results.

• A severe error (5) message specifies an error detected

by

the compiler for which the compiler cannot apply a "fix-up"

with confidence. The resulting program will execute but will nct give ccrrect results.

• An unrecoverable error CU) rressage describes an error that forces termination of the cerrpilatien.

The compiler lists only these rressages with a severity equal to or greater than

that specified by the FLAG c~tion, as shown in Figure 4-10.

~of message Informatory Warning Error

Severe Error

Unrecoverable Error

Option FLAGCI) FLAG CW) FLAGCE) FLAGCS)

Always listed Figure 4-10. selecting the lowest

severity of messages to be printed, using the FLAG option

Each message is identified by an a-character code of the form IELnnnnI, where:

• The first three characters "IEL"

identity the message as coming from the optimizing compiler.

• The next four characters are a 4-digit mess age number.

• The last character "I" is an operating system code for the operator indicating that the message is for information only.

The text of each message, an

explanation, and any recommended programmer response, are given in the rressages

publication for this compiler.

40 OS PLII Optimizing Compiler: Programmer's Guide

RETURN CODES control statements and job scheduler

messages for each step. The meanings of

Possible error (warning) detected; compilation completed; successful execution probable.

Error detected; compilation completed; successful

execution probable.

Severe error detected:

compilation may have been

Dans le document OS PL/I (Page 47-54)