pTAL Conversion Guide

pTAL Conversion Guide527302-002
11-1
11 Structures
Structure declarations in TAL are upward compatible with pTAL structure declarations.
In pTAL, you can use a FIELDALIGN clause or FIELDALIGN compiler directive to
control how the compiler aligns a structure in memory and how it aligns the fields of the
structure within the structure.
Topics:
Pictorial Overview of pTAL Structure Alignment on page 11-1
Overview of Field Alignment on page 11-7
Structure Declarations on page 11-9
NODEFAULT Alignment on page 11-15
Structure Fields on page 11-15
Field Alignment on page 11-16
Structure Alignment on page 11-28
Substructure Alignment on page 11-29
Reference Alignment With Structure Pointers on page 11-30
Alignment Considerations for Structures and Substructures on page 11-34
pTAL Code Generation for Structure References on page 11-35
Equivalenced structures are discussed in Section 12, Equivalenced Variables.
Pictorial Overview of pTAL Structure
Alignment
The memory alignment of structure fields is important when you run a program as a
native process. A field that is aligned for fastest access is “well-aligned.” A field that is
not aligned for fastest access is “misaligned.”
Each structure declaration specifies whether the native compiler is to generate fast
code or conservative code when your program references a field of the structure. Fast
code takes full advantage of the native architecture and produces the best
performance, provided that the field being referenced is well-aligned; however, if the
field is misaligned, an exception occurs. Access to the misaligned field is handled by a
millicode exception handler that completes the access but at a significant performance
cost.
Conservative code is somewhat slower than fast code but does not cause exceptions
when it accesses misaligned data.