[TUHS] PL/I stuff - was: Book Recommendation

Paul Winalski paul.winalski at gmail.com
Sat Nov 27 02:59:35 AEST 2021


Back in the pre-virtual-memory days of the System/360, IBM offered its
compilers in at least three variants:  F, G, and H.  They differed in
the amount of memory required and in features and especially the
sophistication of the optimizations they performed.  IBM PL/I H
required the most memory and performed the highest levels of
optimization.

There were some source language features to aid in optimization.

My shop used PL/I F on DOS/360.  It had one optimization-related
source feature:  the RECURSIVE  and REORDER keywords on the PROCEDURE
statement.

A procedure that may be called recursively, either directly or
indirectly, must have the RECURSIVE attribute.  This tells the
compiler to allocate local variables and temporaries on a call stack
as opposed to statically.  The ABIs for modern OSes always maintain a
stack for procedure calls--not so with S/360/70 OS and DOS.

The REORDER attribute tells the compiler that it is permitted to
execute statements or pieces of statements in an order other than that
explicitly specified in the program, as long as the end result has the
same semantics.  This is taken as a given in modern compilers.

The higher-optimizing versions of IBM S/360 PL/I also had two
PROCEDURE attributes USES and SETS that allowed the programmer to warn
the compiler of side effects.  The USES attribute lists identifiers
global to the procedure that the procedure may read from, either
explicitly or implicitly.  The SETS attribute similarly lists
identifiers that may be modified by the procedure.  If USES is
specified, the compiler can assume that no other global data are
accessed, ans similarly if SETS is specified the compiler can assume
that no other global data will be modified.

Modern compilers perform global data flow analysis for all parts of
the program accessible to the current compilation.  While USES and
SETS even today can potentially be helpful in describing obscure side
effects, they were a very error-prone feature in their day and a real
maintenance nightmare.  They never made it into the ANSI standard and
I think they've been dropped from modern IBM PL/I compilers.

-Paul W.


More information about the TUHS mailing list