4.2 Requirements and Code Design
4.2.2 Provide for Management of Extended Addressing Feature
• Provide for management of the Extended Addressing feature at the appropriate points in the code:
4.2.2.1 Interpretation
DSE management is defined as the techniques used to either clear or load the Data Sector Extension (DSE) of a register which is used to address the DSE sector.
DSE management shall be used only in modules compiled with the #D directive.
DSE management shall occur upon entry to a module, around all calls to external procedures and calls to Runtime Library (RTL) routines, and immediately before exit from a module.
4.2.2.2 Detailed Implied/Derived Requirements a. Prolog
b. Common Subroutine CALL locations.
c. Runtime Library CALL locations.
d. Epilog
4.2.2.2.1 Two fullword constants, $ZDSESET and $ZDSECLR, shall be supplied by FCOS to provide the compiler a means of setting and clearing DSE registers with the proper values.
4.2.2.2.2 For compilation units using the #D directive, the compiler shall generate object code in the prolog of each PROGRAM/COMSUB, which will initialize the DSEs of registers R1 and R3 with the Remote
#D CSECT.
4.2.2.2.3 When the #D directive is used, the DSEs associated with the Remote
#D registers shall be set to zero immediately prior to any external procedure and prior to any RTL call which utilizes R1 or R3 as a base register.
4.2.2.2.4 Immediately upon return from an external procedure or any RTL call which utilizes R1 or R3 as a base register, the DSEs associated with the Remote #D registers shall be restored to their previous values.
4.2.2.2.5 Before the exit from a COMSUB compilation unit using the #D directive, the DSEs associated with the Remote #D registers shall be set to zero. This is not done for PROGRAMs, as the SVC instruction that ends a PROGRAM needs the DSEs set to work properly.
4.2.2.3 Compiler Implementation Design
Figure 4-2 Provide for Management of Extended Addressing Feature 4.2.3 Enforce Compiler Restrictions on #D Data
• Have all program data items take on the attribute “lives REMOTE”; enforce normal compiler restrictions on those data items:
4.2.3.1 Interpretation
For the purposes of syntactical and semantic analysis only, all data which is declared locally, and is within a single compilation unit compiled with the #D directive, shall be processed as if it had been declared with the REMOTE attribute. Again, this data will be referred to as Remote #D data.
All restrictions and limitations which currently exist for REMOTE data references will also exist for Remote #D data references. Refer to Section 8.10 of the HAL/S-FC User's Manual for more information.
Specifically, these restrictions are: a) no assignments of Remote #D addresses into (16-bit) NAME variables; b) not allowing the declaration of Remote #D EVENT variables.
COMMON DATA NEW DATA_REMOTE Boolean 1.0
PASS1 PASS2 PASS3
##DRIVER
add new LDM instruction (2.0)
INITIALISE.SETUP_DATA
set up external recognition of data contents $ZDSESET
and $ZDSECLR (2.2.1)
GENERATE.EMIT_CALL
clear DSEs with LDM before call (2.2.3) set DSEs with LDM after call (2.2.4) GENERATE.BLOCK_OPEN
set DSEs with LDM in prolog (2.2.2) GENERATE.EMIT_RETURN
clear DSEs with LDM in epilog of COMSUBS (2.2.5)
a. No assignments of Remote #D address into (16 bit) NAME variable.
b. No declaration of Remote #D data as EVENT type.
4.2.3.2 Detailed Implied/Derived Requirements
4.2.3.3 Current Error Message Usage
The following existing errors will be used to indicate when the use of Remote #D data has violated a compiler restriction:
4.2.3.2.1 The compiler shall internally “turn on” the REMOTE attribute for all local variables which are declared within a compilation unit containing the #D directive.
4.2.3.2.2 Once the REMOTE attribute is “turned on” for Remote #D data, the compiler shall process the HAL source code using existing error analysis techniques and error messages.
4.2.3.2.3 Because the REMOTE attribute must be “turned off” during code generation (see section 4.2.4.2), supplemental error checking shall be used for parameter checking.
4.2.3.2.4 It shall be legal to assign Remote #D addresses into (32-bit) NAME REMOTE variables. This requires a conversion of a YCON (16-bit offset) plus associated DSE into ZCON format.
4.2.3.2.5 In order for Remote #D data to be passed by reference to REMOTE Runtime Library routines the way current REMOTE data is handled, the YCON to ZCON conversion of 4.2.3.2.4 shall be used.
4.2.3.2.6 The HAL/S WRITE statement shall be the means by which Remote #D data can be output during testing.
DI107 - SEVERITY 1
ATTEMPT TO INITIALIZE A NON-REMOTE NAME WITH A REMOTE VARIABLE
XQ102 - SEVERITY 2
ATTEMPT TO ASSIGN NAME OF REMOTE DATA ITEM TO A 16 BIT NAME VARIABLE
FT111 - SEVERITY 2
MISMATCHED ARGUMENTS IN %NAMECOPY STATEMENT. REMOTE SOURCE NOT ALLOWED WITH NON-REMOTE DESTINATION IN
%NAMECOPY STATEMENT FT110 - SEVERITY 2
MISMATCHED ARGUMENTS IN %NAMEADD STATEMENT. REMOTE SOURCE NOT ALLOWED WITH NON-REMOTE DESTINATION IN
%NAMEADD STATEMENT FT112 SEVERITY 2
PARAMETER #?? MAY NOT BE NAME(NAMEVAR) IF NAMEVAR LIVES REMOTE
DA9 - SEVERITY 2
ILLEGAL ATTRIBUTE SPECIFIED FOR EVENT DATA TYPE
4.2.3.4 FCOS Restrictions on #D Data
Due to FCOS restrictions, certain real time operations cannot occur with DATA_REMOTE in effect (i.e. outside of sector 0/1). An XR4 error message (severity 2) will be generated for any of the following conditions when DATA_REMOTE is in effect:
- EQUATE EXTERNAL to a #D symbol;
- SCHEDULE statement with an ON, WHILE or UNTIL event option in a non-reentrant module;
- WAIT FOR statement in a non-reentrant module.
4.2.3.5 Compiler Implementation Design
Figure 4-3 Enforce Compiler Restrictions on #D Data
COMMON DATA NEW DATA_REMOTE Boolean
symbol table REMOTE attribute flags
PASS1 PASS2 PASS3
SYNTHESIZE
in processing declared data: new GENERATE.PARM_STAT
set REMOTE attribute (3.2.1) if CSECT_TYPE of parameter is #D (3.2.2)
then error FT108 (3.2.3)
GENERATE.VMCALL CHAR_CALL, CTON, COMPARE_STRUCTURE GEN_CLASS0.USE_MSTRUC GEN_CLASS0
setup to call REMOTE RTL routine if
CSECT_TYPE of parameter is #D (3.2.5) GENERATE.BIT_STORE
CHAR_CALL, CTON, GEN_CLASS0
GEN_CLASS1 (3.2.3)
GENERATE.STRUCTFIX, GET_OPERAND
if CSECT_TYPE of data is #D
then set Boolean LIVES_REMOTE to trigger NAME error-checking
(3.2.2) GENERATE.CLASS0.SET_IO_LIST
if CSECT_TYPE of aggregate is #D then copy to stack before calling, then copy to stack before calling output RTL routine
(3.2.6) GENERATE.FORCE_ADDRESS
if data assigned to NAME_REMOTE does not have REMOTE attribute
then convert to YCON+DSE to ZCON
(3.2.4)