NonStop S-Series Server Description Manual (G06.24+)

TNS Execution Modes
HP NonStop S-Series Server Description Manual520331-003
6-34
Defining the Procedure’s Data
Defining the Procedure’s Data
As previously explained, the first half of the user data segment contains the process’s
global variables and TNS user data stack. The left part of Figure 6-20 illustrates the
overall organization of the user data segment.
Variables in the global data area are addressable by any instruction in the TNS
procedure. The addressing base of the global area is defined as G[0], and individual
locations in this area are referenced with G-relative addresses. The primary global
area exists within the first 256 words of the segment. This area is accessed with direct
addressing. It can contain indirect addresses to anywhere in the segment, but they
often point into an area of secondary global data beginning at a location immediately
following the last primary variable. The secondary global data area can be much larger
than the primary area.
The user data stack (or TNS stack) is where the manipulation of memory data by TNS
instructions takes place. When a procedure is called into execution, that invocation is
allocated its own temporary storage area on the stack, called a stack frame. This
stack frame, which consists of memory data that the procedure is currently using, is
known only to that invocation of the procedure and is logically separate from the stack
frames of other procedures.
At any moment many frames may be in existence, one immediately following another.
The first frame on the stack is that of the program’s main procedure. The base of the
stack frame is defined by the 16-bit L register. The L (for Local) register contains the
G-relative address base of the procedure’s local data and is defined as L[0]. Elements
following (and preceding) L[0] can be addressed with positive or negative offsets.
The current top-of-stack location is defined by the 16-bit S register, which contains
the G-relative address of the last word currently defined in the user data stack. This
address is defined as S[0], and it serves as an addressing base for a top-of-stack area
called the sublocal area. This sublocal area consists of up to 32 word locations
including and preceding S[0]; it is typically used by subprocedures. Data in the
sublocal area is known only to the currently executing subprocedure.
During the execution of a procedure, the address in the S register advances as
elements are moved from the register stack to the top of the user data stack, and
recedes as elements are moved from the top of the user data stack to the register
stack.