TNS/E Native Application Conversion Guide
Developing a Conversion Strategy
TNS/E Native Application Conversion Guide—529659-003
2-8
Tuning the Performance of Native Programs
Both TNS/R and TNS/E systems offer facilities for detecting misaligned addresses and
for controlling program action if a misalignment is detected. For more information on
detecting and correcting data misalignments, see:
•
Binder Manual
•
C/C++ Programmer’s Guide
•
pTAL Reference Manual
•
TAL Programmer’s Guide Data Alignment Addendum
Tuning the Performance of Native Programs
To get the maximum performance from a native program, make sure that your program
does not spend excessive time in compatibility traps caused by data misalignment.
Detecting Compatibility Traps
Compatibility traps can be detected by using the Measure PROCESS entity during a
representative run of your program. The PROCESS entity COMP-TRAP counter
contains the number of compatibility traps.
If you detect significant compatibility traps, use the EPTRACE tool against the program
during another representative run. EPTRACE reports the type of each compatibility
trap and the code address of where each trap occurred. Next, use the enoft utility to
map the code address from EPTRACE to the source code location in the program.
Measure and EPTRACE run only in the Guardian environment. Use an OSS run
gtacl command to run them from the OSS environment.
Eliminating Compatibility Traps
In most cases, data misalignment in data objects and reference misalignment in
pointers cause traps. To eliminate compatibility traps caused by data misalignment in
data objects, specify a FIELDALIGN SHARED2 pragma or directive for the misaligned
data object.
By default, the native compilers generate code for pointer dereferencing operations
that expects the pointer to contain an address that satisfies the alignment requirements
of the data object being pointed to. For example, a 4-byte object should have an
address which is a multiple of four. If the data object is at an address that does not
satisfy its alignment requirements, a compatibility trap occurs. To avoid this
compatibility trap, specify a REFALIGNED 2 pragma or directive on the pointer to the
object. This directs the native compilers to generate code that assumes the
dereferenced object is not properly aligned and compensates for the improper
alignment. While REFALIGNED 2 always generates a few extra instructions for each
dereferencing operation, a compatibility trap results in hundreds of additional
instructions.










