pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
SHARED2 Parameter
Since the SHARED2 parameter is included with both the FIELDALIGN clause and the FIELDALIGN
compiler directive, the following information relates to both usages:
• In a SHARED2 structure, all fields must begin at an even-byte address except STRING fields,
which can begin at any byte address, and UNSIGNED fields, which can begin at any bit
address except as follows:
◦ An UNSIGNED(1-16) field cannot cross an even-byte address boundary.
◦ An UNSIGNED(17-31) field can cross only one even-byte address boundary.
◦ An UNSIGNED field that is not preceded by an UNSIGNED field must begin at an
even-byte address.
• The address type of pointers in a SHARED2 structure must be EXTADDR, EXT32ADDR,
EXT64ADDR, PROC32ADDR, PROC64ADDR, SGBADDR, or SGWADDR; for example:
STRUCT s FIELDALIGN(SHARED2);
BEGIN
INT .EXT ea; ! OK: EXTADDR pointer
INT .EXT32 e32a; ! OK: EXT32ADDR pointer
INT .EXT64 e64a; ! OK: EXT64ADDR pointer
INT .SG j; ! OK: SGWADDR pointer
STRING .s; ! ERROR: BADDR pointer is not valid
END;
NOTE: The address types, EXT32ADDR, EXT64ADDR, PROC32ADDR, and PROC64ADDR
are available in the 64-bit addressing functionality added to the EpTAL compiler starting with
SPR T0561H01^AAP. For more information, see Appendix E, “64-bit Addressing Functionality”
(page 531).
• If the data type of a field in a SHARED2 structure is an address type, the type must be
EXTADDR, EXT32ADDR, EXT64ADDR, PROC32ADDR, PROC64ADDR, SGBADDR, or
SGWADDR; for example:
STRUCT s FIELDALIGN(SHARED2);
BEGIN
EXTADDR ea; ! OK
EXT32ADDR e32a; ! OK
EXT64ADDR e64a; ! OK
PROCADDR pa; ! ERROR: not allowed in SHARED2 struct.
PROC32ADDR p32a; ! OK
WADDR w; ! ERROR: not allowed in a SHARED2 struct;
END;
• If you include a FIELDALIGN(SHARED2) compiler directive, include a REFALIGNED(2) compiler
directive as well. The default for the REFALIGNED compiler directive is 8. With field alignment
SHARED2, pTAL can allocate a 32-bit or 64-bit field at any even-byte address. pTAL generates
optimal code for data references that use a pointer whose reference alignment is 8. If the
pointer is used to reference 32-bit or 64-bit data that is not well-aligned, each reference to
the data will be slow. By default, pTAL generates conservative code when you reference data
using a pointer that specifies REFALIGNED(2). The REFALIGNED(2) directive ensures that pTAL
generates conservative code for pointers that do not specify a REFALIGNED clause.
128 Structures