Guardian Procedure Calls Reference Manual
Considerations
• Checkpointing the stack
Checkpointing the entire data stack has the effect of providing a restart point for the backup
process. The stack-origin parameter gives you the option of specifying how far into the
stack to start checkpointing. Although native stacks grow downward while TNS stacks grow
upward, the effect is the same—all data from stack-origin to the growing tip of the stack
is checkpointed.
The rules for specifying the stack-origin address, however, are different for TNS processes
and native processes. In a TNS process, you can include global variables to be checkpointed
with the stack data, because the global variables immediately precede the stack; thus you
can checkpoint all global variables with the stack by specifying a stack-origin address
of zero (0).
In a native process, you cannot checkpoint global data with the stack, because global variables
are not adjacent to the stack. If the stack-origin parameter is specified for a native process,
it must point to a location within the data stack itself. To checkpoint global data, you must do
so explicitly by providing a descriptor for each area of global data you want to checkpoint.
Note that this approach works for TNS processes as well as for native processes; therefore a
program written this way can be compiled for either architecture.
Establishing the stack-origin address can be done in several ways. These approaches
work for both TNS and native processes:
◦ To checkpoint the entire stack, set the stack-origin address to -3. In a TNS process
this value is the equivalent of the initial -L value in the TNS stack area. In a native process
this value indicates the start of the main stack.
◦ To checkpoint starting from the origin of an arbitrary procedure, introduce a lower
procedure to obtain its stack address. For example, assume a procedure MYPROC is to
be the base procedure for a stack checkpoint; you can obtain its stack address in a global
pointer STACKBASE as follows:
INT .STACKBASE;
PROC SET_MYPROC_BASE;
BEGIN
INT .DUMMY;
@STACKBASE := @DUMMY;
CALL MYPROC;
END;
The stack-origin address (if you do not specify the value -3) designates the boundary
between what is to be checkpointed with the stack and what is not. In native processes,
which use descending stacks, the address is that of the first byte not to be checkpointed.
In a TNS process, it is the address of the first byte included in the checkpointed data.
Other methods of establishing the stack-origin address work only with TNS processes.
These methods include:
◦ Refer to the L register.
◦ Pick up the address of a local variable other than as described above for a procedure
call. This approach does not work for native processes because the location of local
variables in the enclosing stack frame is not defined by the compiler other than by
inclusion.
CHECKPOINTMANYX Procedure 151