Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (C)
Guardian Procedure Calls Reference Manual—522629-013
3-61
CHECKPOINTX Procedure
•
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.
If the
stack-origin parameter is omitted, the stack is not checkpointed. You
can, however, include the
stack-origin parameter without checkpointing the
stack by setting
stack-origin to -1.
•
Checkpointing data areas
Checkpointing specific variables involves specifying the address of a data area in
the
bufferx-n parameter and a byte count in count-n. Differences in data
layout between a TNS stack and a native main stack cause some restrictions in the
way native processes address these buffers. The following rules apply to native
processes. Code that follows these rules can be compiled to run as either a TNS
process or a native process:
•
To checkpoint global variables, refer to the variables themselves. Do not use
constant addresses.
•
If your program depends on two global variables being adjacent, you must
ensure that they are in a data block together. In pTAL, this is done
automatically if blocks are not explicit and if the BLOCKGLOBALS compiler
directive is not used.
•
Do not assume adjacency or order of local variables; use structures or arrays.