pTAL Reference Manual (H06.03+)
Structures
HP pTAL Reference Manual—523746-005
9-31
REFALIGNED(8)
The field alignment of s and s_templ is SHARED8. Because the declaration of p1
does not specify a REFALIGNED clause, the statement a := p1.i might cause
performance degradation. See REFALIGNED(8) on page 9-31. The pointers p3, p4,
and p5 specify REFALIGNED(2). Compared to p1, references to p3, p4, and p5 will
have somewhat degraded performance when the fields they reference are well-
aligned. When the fields they reference are not well-aligned, references to p1 will have
significantly degraded performance compared p3, p4, or p5.
REFALIGNED(8)
When the reference alignment specified for a structure pointer is 8, the code generated
by pTAL for each reference to the pointer assumes that the base of the structure and
the fields in the structure are well-aligned in memory. If the field alignment of a
structure is SHARED8—or is declared AUTO and the program is compiled by pTAL to
run on RISC and Itanium architecture—and the base of the structure is well-aligned,
references to the pointer will execute with optimal performance in both pTAL and TAL.
If a structure pointer specifies REFALIGNED(8) or inherits its reference alignment from
a SHARED8 structure, but the base of the structure is not well-aligned, your program
might run significantly slower than you anticipate. You will observe significantly
degraded performance if your REFALIGNED(8) pointer references a structure field that
is not, in fact, well-aligned. Each such reference in your program will cause a trap to
the millicode exception handler, which accesses the field your program is referencing
and then returns to your program. Your program’s behavior is not affected by having to
access the field from the exception handler except that its performance for each such
trap is significantly degraded.
pTAL generates conservative code for references to a pointer that specifies
REFALIGNED(8) if it detects that a trap would occur if it generated optimal code.
Example 9-27. REFALIGNED(8)
STRUCT t1 (*) FIELDALIGN(SHARED2);
BEGIN
INT(32) i;
END;
STRUCT t2 (*) FIELDALIGN(SHARED8);
BEGIN
STRUCT s (t1);
INT(32) i;
END;
INT .EXT p1 (t1) REFALIGNED (8) := extended-address;
INT .EXT p2 (t2) REFALIGNED (2) := extended-address;
INT .EXT p3 (t2) := extended-address;
INT(32) i32;
i32 := p1.i;
i32 := p2.i;
i32 := p3.s.i;










