Communicator e3000 MPE/iX Release 7.0 Express 1 (Software Release C.70.01) (30216-90328)
118 Chapter5
Technical Articles
Pascal/iX has $VOLATILE_WITH Option Enhancement
Pascal/iX has $VOLATILE_WITH Option Enhancement
By James Overman
Computer Systems Division
The HP31502A.05.04 release of Pascal/iX has changes for processing of the $VOLATILE
option results. The compiler will now flag as errors certain uses of volatile references that
are questionable as to the user's desired meaning. The new error message will only be
produced if a $VOLATILE variable is used in a WITH statement. A new option
$VOLATILE_WITH has been created to allow users to specify the compiler's processing of
WITHs with volatile references. Also, the $VOLATILE option has been expanded to be
valid in a new position within a type declaration.
In previous versions of Pascal/iX, the volatility of a WITH expression was not taken into
consideration when generating alias information for the optimizer. A WITH result pointer
is actually the address of the record referenced by the WITH expression. Although there is
no documentation about what should happen when volatile pointers occur in WITH
expressions, the previous situation is questionable since at least some existing code
assumes that the volatility is transferred to the WITH result pointer. There is also the
question of how far down the WITH expression to look for volatility before making the
WITH result pointer volatile. Some users may want to make the WITH volatile if either
the record or pointer is volatile, and some may not want the WITH volatile at all.
Here are the details of the change:
1. The compiler was enhanced to allow users to specify that the pointed-to type is volatile.
This was done by adding a new place where $VOLATILE$ is legal:
<simple-type> = $VOLATILE$ <ident>
For example, the following code declares a volatile pointer:
ptr_mytype = ^ $VOLATILE$ mytype;
To change this into a declaration of a pointer to a volatile type:
ptr_mytype = ^ v_mytype;
v_mytype = $VOLATILE$ mytype;
2. The user must now specify how they want volatility handled in WITH statements if
they use volatile records or pointers. The "top type" of the WITH expression is checked
for a volatile record or pointer and an error is generated if the user has not specified
how it should be handled. A new compiler option
$VOLATILE_WITH has been added to allow the user to tell the compiler what it
should do in this situation:
$VOLATILE_WITH 0$ : do not make WITH temps volatile. This will generate the
most efficient code, but may not be "safe."
$VOLATILE_WITH 1$ : make the WITH temp volatile if the top level record type is
volatile. (This is provided for completeness, it is unclear how useful it would be.)
$VOLATILE_WITH 2$ : make the WITH temp volatile if the top level record type or