pTAL Conversion Guide

Structures
pTAL Conversion Guide527302-002
11- 8
Overview of Field Alignment
AUTO directs the compiler to align structure fields for optimal access for the
intended process type of the object file. Specify AUTO only for structures whose
data exists solely within a process, or across multiple processes of the same type.
In general, the optimal layout of a structure on native architecture is not the same as
the layout of a structure generated by TAL. A structure’s layout can be different on TNS
and native architectures if the structure describes data that is used only within a
process and only for the duration of the process. In this case, you can specify AUTO
as the FIELDALIGN parameter.
If you are sharing data with other programs or processes, however, use SHARED2 or
SHARED8 alignment.
Declare structures with SHARED2 alignment:
If you use the structures to exchange information with other processes that are not
converted to native structure layout.
If your process is already limited by the available stack space on TNS architecture.
Declare structures with SHARED8 alignment:
If you want optimal performance on native architecture.
The fields you reference in the structure are well-aligned.
If all processes that share the data can use SHARED8 alignment.
The layout of structures and the alignment options you specify affect the object code
generated by pTAL. If you specify that the fields of a structure are not well-aligned
that is, you specify SHARED2 alignment—pTAL generates conservative code for each
reference. Conservative code might require more instructions to reference structure
fields than references to well-aligned fields.
If, however, you specify that the fields in a structure are well-aligned—that is, you
specify SHARED8 alignment—pTAL generates code that accesses the fields of the
structure with optimal—fast—performance.
If you specify that a structure and its fields are well-aligned, but, in fact, they are not
well-aligned, your program traps to the millicode exception handler to resolve each
access to an unaligned field. The millicode exception handler accesses the field and
returns to your program.
A data reference that causes a trap is significantly slower than a reference that does
not cause a trap. As a result of the traps for unaligned fields, you might see
considerable performance degradation in your program.
Conservative code, on the other hand, does not cause traps.
Topics:
Field and Base Alignment on page 11-9
Base Alignment on page 11-9