User`s guide

How the MACRO Compiler Functions on Different Platforms
2.11 Preserving VAX Atomicity and Granularity
an OpenVMS AXP System: Recompiling and Relinking Applications
1
for a more
complete discussion of the programming issues involved in read-modify-write
operations in an Alpha system.
Warning
When preserving atomicity, the compiler generates aligned memory
instructions that cannot be handled by the Alpha PALcode unaligned
fault handler. They will cause a fatal reserved operand fault on unaligned
addresses. Therefore, all memory references for which .PRESERVE
ATOMICITY is specified must be to aligned addresses (see Section 2.11.5).
2.11.2 Preserving Granularity
To preserve the granularity of a VAX MACRO memory write instruction on a byte,
word, or unaligned longword on Alpha means to guarantee that the instruction
executes successfully on the specified data and preserves the integrity of the
surrounding data.
The VAX architecture includes instructions that perform independent access to
byte, word, and unaligned longword locations in memory so two processes can
write simultaneously to different bytes of the same aligned longword without
interfering with each other.
The Alpha architecture, as originally implemented, defined instructions that
could address only aligned longword and quadword operands. However, byte and
word operands for load and store were later added.
On Alpha, code that writes a data field to memory that is less than a longword
in length or is not aligned can do so only by using an interruptible instruction
sequence that involves a quadword load, an insertion of the modified data into the
quadword, and a quadword store. In this case, two processes that intend to write
to different bytes in the same quadword will actually load, perform operations on,
and store the whole quadword. Depending on the timing of the load and store
operations, one of the byte writes could be lost.
The Itanium architecture has byte, word, longword, and quadword addressibility,
so granularity of access is easily obtained without having to request it with an
option or declaration.
The compiler provides the /PRESERVE=GRANULARITY option to
guarantee the integrity of byte, word, and unaligned longword writes. The
/PRESERVE=GRANULARITY option causes the compiler to generate Alpha
instructions that provide granularity preservation for any VAX instructions that
write to bytes, words, or unaligned longwords. Alternatively, you can insert the
.PRESERVE GRANULARITY and .NOPRESERVE GRANULARITY directives in
sections of VAX MACRO source code as required to enable and disable granularity
preservation.
1
This manual has been archived. It is no longer maintained and is not part
of the OpenVMS documentation set. However, you can view it online at
http://www.hp.com/go/openvms/doc.
2–24 How the MACRO Compiler Functions on Different Platforms