pTAL Conversion Guide
Data Allocation
pTAL Conversion Guide—527302-002
5-3
Reference Alignment
The native compilers generate either conservative code or fast code for each data 
access. Conservative code uses two native instructions to access 32-bit data. Although 
conservative code is somewhat slower than fast code, it will not cause an exception, 
regardless of how the data is aligned. Use conservative code for pointers to data that 
you have not explicitly allocated, such as data in a heap and data in reference 
parameters.
Fast code uses the smallest number of native instructions to access data and provides 
the fastest access; however, if the compiler generates fast code to access data that is 
not well-aligned, each such reference will cause an exception. The millicode exception 
handler will access the data and complete the operation for your program. Your 
program will work correctly and will not be affected by the exception. References 
handled by the millicode exception handler, however, take significantly longer to 
complete than other data accesses; therefore, specify fast code for a pointer only if you 
are very confident that the data it references will be well-aligned. Otherwise, specify 
conservative code.
The native compilers control where simple variables are allocated and what code 
references them. The compilers cannot, however, use the same approach for data 
referenced by addresses in pointers. The following topics describe pTAL features that 
enable you to control the code that the native compilers generate for data you 
reference through pointers. 
Reference Alignment
This topic explains how you control the code that the native compiler generates when 
you use pointers to reference nonstructure data. For information about references to 
data in structures, see Section 11, Structures.
When you declare a nonpointer variable, the native compiler determines where the 
data is stored and ensures that the data is well-aligned for fast access. When you 
reference data with a pointer, however, the data referenced by the pointer might or 
might not be well-aligned. The native compiler cannot determine at compile time 
whether to generate fast code or conservative code for references made to data using 
the pointer; therefore, you specify in the pointer declaration whether the compiler is to 
generate fast or conservative native code for all data referenced by the pointer.
The REFALIGNED clause on a pointer declaration and the REFALIGNED compiler 
directive control the code the compiler generates each time you use a pointer to 
reference data.
Each pointer you declare can include a REFALIGNED clause which specifies whether 
the data referenced by the pointer will be well-aligned and, accordingly, whether the 
compiler is to generate conservative code or fast code for each reference that uses the 
pointer.










