pTAL Conversion Guide

Pointers
pTAL Conversion Guide527302-002
10-39
Pointers With the Same Widths on TNS and Native
Architectures
Figure 10-6 on page 10-38 illustrates the following points:
The source code is the same for both TNS and native processes.
TAL allocates 16 bits for a standard pointer on TNS architecture. pTAL allocates 32
bits for a standard pointer on native architecture.
A standard pointer holds a word address on TNS architecture, but holds a byte
address on native architecture.
The location of the data referenced by a pointer might not be at the same offset on
TNS and native architectures relative to the location of the pointer itself.
Pointers With the Same Widths on TNS and
Native Architectures
On both TNS and native architectures:
SGBADDR and SGWADDR addresses are 16 bits.
If you know that all modules that reference a shared source file have been
converted to pTAL, you can change .SG variables to .SGX variables for better
program performance.
EXTADDR addresses are 32 bits.
Reference Alignment with Nonstructure
Pointers
When you declare a pointer that might reference data that does not have the current
default alignment, use the REFALIGNED clause.
If the pointer might reference data that might not be well-aligned on native architecture,
declare the pointer with the clause REFALIGNED(2)
on page 10-40. This causes the
native compiler to generate conservative code for every reference to the pointer.
If you know the a pointer will reference only data that is well-aligned on native
architecture, you can declare that pointer with the clause REFALIGNED(8)
on
page 10-40. This causes the native compiler to generate fast code for every reference
to the pointer.
If you declare a pointer without a REFALIGNED clause, the compiler uses the
reference alignment specified by the compiler directive REFALIGNED on page 19-25.
If your program does not include a REFALIGNED compiler directive, the compiler uses
the default reference alignment, which is REFALIGNED(8).