Accelerator Manual (G06.27+, H06.04+, J06.03+)

Accelerator Performance Issues
Accelerator Manual527303-003
6-17
Relative Segments 2 and 3 Traps
The following variation works without generating a compatibility trap:
DEFINE SETBITG(VECTOR,BIT) =
BEGIN ! BIT = 0..N
STACK %100000 '>>' BIT.<12:15>;
STACK @VECTOR[ BIT '>>' 4 ]; ! OK
CODE( ORX );
END#;
Relative Segments 2 and 3 Traps
Attempts to form a pointer to process-relative (P-relative) data in relative segments 2 or
3 causes a compatibility trap unless the reference is made using the TAL $XADR
function.
TNS systems can address two code segments, current code and user code, using two
special segment numbers, 2 and 3. TAL forms extended addresses to P-relative data
by using a special instruction, SCS, to insert the value of the relevant code segment
into the 32-bit address. TNS/R systems redefine the SCS instruction to insert the real
address of code into the segment field of the 32-bit address instead of a 2 or a 3. This
inserted value is around 8,500.
Compiler-generated and user-coded 32-bit addresses to P-relative data that do not use
the SCS instruction cause a compatibility trap when attempting to reference one of
these segments.
Detection Guideline
Use the PROCESS/PROCESSH report produced by the Measure performance
analysis tool to find the number of compatibility traps.
Suggested Changes
Use the $XADR function of TAL to generate the correct 32-bit P-relative address.
Recompile with a version of the COBOL85 compiler released on or after 01DEC90
if the program contains an EXTENDED-STORAGE section.
Programs should not rely on specific segment numbers. These addresses will
change in future software releases.
Examples
INT PREL = 'P' := ["foo "];
INT .ext XPREL;
@XPREL := $XADR(PREL); ! Correct
@XPREL := $DBLL(3,@PREL) '<<' 1; ! Incorrect
The $XADR function works correctly because TAL has always had to emit the SCS
instruction to insert the current code segment number into the 32-bit address. On
TNS/R systems, the SCS instruction inserts the virtual code address into the 32-bit
address.