CEEGOTO is used to restart execution at a specified label within
a stack frame. It is supported to work only from one language to that
same language.
CEEGOTO operates within a single thread (and thus, on one stack)
and can only target earlier stack frames on that stack. If the Language Environment condition
manager is on the stack and the range of CEEGOTO is from a stack frame
more recent than the Language Environment condition
manager to a stack frame less recent than the Language Environment condition
manager, the Language Environment condition
manager pops off the stack and the corresponding condition handler
is terminated at that point. For more deeply nested conditions, several
can be canceled at once.
A return to the caller occurs only when the feedback token is provided
and a condition is detected.
Syntax
void CEEGOTO (
target_id,
[
fc])
LABEL *target_id;
FEED_BACK *fc;
- CEEGOTO
- Call this CWI interface as follows:
L R15,CEECAACELV-CEECAA(,R12)
L R15,20(,R15)
BALR R14,R15
- target_id (input)
- A label variable passed by reference. The first word of the label
points to an active DSA. The DSA does not necessarily need to exist
within the Language Environment-managed
stack. However, it does need to be on the back chain of save areas.
The second word of the label variable points to the instruction that
receives control when CEEGOTO is run. If this address is zero, then
the address is obtained from the saved R14 in the DSA specified in
the first word. AMODE information is obtained from the high-order
bit of the address.
The target_DSA_address field in the first
4 bytes of a non-XPLINK label
variable is always non-zero. The base_register_instruction contains
an instruction that, when run using an assembler EX instruction, restores
the base register(s) needed by the target_instruction.
A non-XPLINK label
variable cannot be used to GOTO or resume an XPLINK routine. Figure 1 shows the format of the non-XPLINK label
variable.
Figure 1. Format
of a non-XPLINK label
variable
The first 4 bytes of an extended label variable are zero.
An extended label variable can be used to GOTO or resume either an XPLINK or non-XPLINK routine.
When resuming an XPLINK routine,
the resume registers are contained in the extended label variable
itself, not the DSA to be resumed. Figure 2 shows
the XPLINK extended
format label variable.
Figure 2. XPLINK extended
format label variable
Note: The storage for the label variable is expected to be
allocated within the storage of the lexical scope of the label variable
so that the storage is released when the lexical scope is collapsed.
Figure 3 shows the XPLINK extended
format label variable – resume area.
Figure 3. XPLINK extended
format label variable – resume area
Table 1. Vector Register save area+00 |
Vector Register save area version |
+02 |
(reserved) |
. . . |
|
+10 |
Vector Registers 0-31 (16-bytes each) |
. . . |
|
+210 |
Start of HLL-specific area - length not specified
- can be 0 - length |
- fc (output/optional)
- One of the following condition tokens, which are passed by reference.
A return to the caller occurs only when a condition is detected.
Condition |
|
CEE07Q |
Severity |
2 |
Msg_No |
0250 |
Message |
The target_id was
not found on the stack. |
CEE07R |
Severity |
2 |
Msg_No |
0251 |
Message |
An invalid target_id was
provided. |
Usage Notes: - As routines are popped off the stack, the DSA exit routines are
invoked for those DSAs marked as an exit DSA.
- The base_register_instruction in the
label variable is run using the assembler instruction EX and is intended
to restore the base register needed by the target instruction. This
instruction is executed immediately prior to the branch to the target_instruction.
The values of the registers are as follows:
- R0-R12
- Restored from the target_dsa
- R13
- The target_dsa
- R14
- The address of the target_instruction
- R15
- The address of the base_register_instruction
When resuming with an extended-format LABEL variable
that resides in an XPLINK DSA or
alloca() area, that area may have been freed before the base_register_instructon is
executed.
When resuming into an XPLINK function,
the register values when the EX instruction is executed are:
- R0-R3
- Restored from extended format resume area in the LABEL variable
- R4
- Address of the target_dsa
- R5
- Restored from Extended format resume area in the LABEL variable
- R6
- The address of the base_register_instruction.
This instruction is not copied to a safe place before it is executed,
so it must not reside in an XPLINK DSA or XPLINK alloca()
area that will get freed when CEEGOTO runs.
- R7
- The address of the target_instruction
- R8-R15
- Restored from extended format resume area in the LABEL variable
- If the base_register_instruction is
zero, the EXecute is not performed.
- CEEGOTO requests from a POSIX application (using longjmp() or siglongjmp())
are intercepted so that proper cleanup routine and destructor function
invocation can take place. While executing a cleanup routine (for
example, a routine established using CEECPSH), a CEEGOTO results in
execution of all of the pushed, but not popped cleanup routines
for more recent stack frame's than the target stack frame. This rule
applies for both normal processing and for the execution of cleanup
routines during thread termination. If the jump buffer was established
in the cleanup routine (for example, the target of the CEEGOTO is
in the same cleanup routine) control continues at that point.
CEEGOTO
invocation while processing a destructor function (during thread termination)
is allowed, but the target of the jump must be established by the
destructor function. (This is required since all of the user code
has been removed from the stack.)
- When resuming an XPLINK routine
that issues an alloca(), any alloca() requests that were done after
the LABEL variable was set up will be undone. When resuming into a
non-XPLINK routine,
alloca() requests already made by that routine are not undone.
- A non-extended format LABEL variable passed to CEEGOTO must not
reside in an XPLINK DSA
or alloca() area that will get freed when the program is restarted.
- An extended format LABEL variable passed to CEEGOTO can reside
in an XPLINK or
non-XPLINK DSA
that will be freed when execution is restarted. It can also reside
in storage obtained using XPLINK alloca()
that will be freed when execution is restarted. The LABEL variable
can also reside elsewhere, in which case CEEGOTO will not free it.
- When an XPLINK program
is restarted, register 7 always points to the target_instruction.
When a non-XPLINK program
is restarted, register 14 always points to the target_instruction.
This may limit the use of CEEGOTO to restarting progams at a return
point after a call.
- The base_register_instruction will not
be copied into a safe place before CEEGOTO is executed with the EX
instruction. The base_register_instruction and
any operands it uses must not reside in an XPLINK DSA or XPLINK alloca()
area that is freed during the processing in CEEGOTO.
- Because FPRs 0-15 share the same
storage with bytes 0-7 of VRs 0-15, the content of FPRs save area
overrides the content of Vector Registers save area when they are
both provided in extended format resume area, in the LABEL variable.