NonStop S-Series Server Description Manual (G06.24+)
TNS Execution Modes
HP NonStop S-Series Server Description Manual—520331-003
6-56
Multiple Markers for Nested Calls
Multiple Markers for Nested Calls
In examples shown previously, only one procedure call occurred and, therefore, only 
one stack marker was generated. However, in practice, there can be several stack 
markers (and stack frames) present in a memory stack at once. This occurs when a 
called procedure calls another procedure and that procedure calls still another 
procedure, and so on. Because one of the words in each marker (the saved L register) 
points back to the previous stack marker, the result is a “chain” of stack markers.
The nature of this chain of stack markers and the action of the L and S registers is 
such that the stack frames are positioned in chronological order, and returns are 
always made in the reverse order of the calls. The stack frames are made current 
again as the returns are made.
Figure 6-31 shows the condition of a memory stack after the following calls have taken 
place:
In main procedure A, CALL B;
 In procedure B, CALL C;
 In procedure C, CALL D;
This sequence can be traced out in the fragment of code segment shown at the left 
side of the figure. Note the PCAL instruction in each procedure pointing to the entry 
point of the succeeding procedure. (For simplicity, calls are shown going to the next 
contiguous procedure in the segment; in practice, calls can jump from one extreme to 
the other in the code segment.) The procedure D is currently executing, as indicated 
by the P register setting.
Now note the chain of stack markers on the right side of the figure. The current 
L register setting is 452. At G[452] is the saved L value in the most recent stack 
marker. That value is 237, meaning that when procedure D exits back to C, the 
L register pointer will jump back to G[237]. Likewise, when C exits back to B, L will 
jump back to G[163], and when B exits back to A, L will jump back to G[123]. At the 
moment shown, however, the chain exists as an explicit chain of references going back 
to the base of the first stack frame on the stack.
Note also that the first word of each marker contains the P register value that tells 
where the preceding procedure must resume execution when the return is made. For 
example, when D exits, the P pointer in the most recent stack marker, the value 1485, 
will be loaded into the P register. That will cause execution to resume at C[1485], in 
the code segment—which is the location immediately following the instruction that 
called D.










