Accelerator Manual (G06.24+, H06.03+)
Accelerator Performance Issues
Accelerator Manual—527303-002
6-16
Odd-Byte References Traps
The results of odd-byte references to doublewords and quadruplewords are
unpredictable on TNS/R systems. Refer to Odd-Byte References on page 2-10 for
details.
Detection Guidelines
•
Use the PROCESS/PROCESSH report produced by the Measure performance
analysis tool to find the number of compatibility traps.
•
Look for uninitialized pointers. Many odd-byte references to 2-byte words result
from uninitialized 32-bit pointers (a previously undetected programming error).
Suggested Change
•
Remove odd-byte references to 2-byte words from your programs.
Examples
•
The following program fragment results in address alignment compatibility traps:
INT .EXT WPTR;
STRING .EXT SPTR = WPTR; ! Same ptr as WPTR
INT BITNO;
@SPTR := @SPTR[3]; ! TROUBLE
! WPTR is 3 also
IF WPTR.<7:15> = 0 THEN ! Compatibility trap
•
A known deliberate use of odd-byte references occurred in the following CODE
statements implementing bit vector operations:
INT .EXT VECTOR;
DEFINE SETBIT(VECTOR,BIT) =
BEGIN ! BIT = 0…N
STACK %100000 '>>' BIT.<12:15>;
STACK @VECTOR
+ $DBLL(0,BIT '>>' 3); ! TROUBLE
CODE( ORX );
END#;
•
The word that BIT is in is calculated by dividing BIT by 16 bits per INT16, and
shifting left to an INT16 offset. The left shift is folded into the divide, thus saving
one left shift. The one right shift of BIT '>>' 3 results in an odd-byte address for half
of all the values of BIT, and results in a compatibility trap.