User`s guide

Recommended and Required Source Changes
3.3 Flow Control Mechanisms
Rout: .JSB_ENTRY
.
.
.
JSB continue_label
RSB
3.3.4 Removing the Return Address from the Stack
The compiler detects the removal of the return address from the stack (for
instance, TSTL (SP)+) and flags this practice as an error. The removal of a
return address in VAX code allows a routine to return to its callers caller.
Recommended Change
Rewrite the routine so it returns a status value to its caller that indicates that
the caller should return to its caller. Alternatively, the initial caller could pass
the address of a continuation routine, to which the lowest-level routine can
JSB. When the continuation routine RSBs back to the lowest-level routine, the
lowest-level routine RSBs.
For example, the compiler would flag the following code as requiring a source
change:
Rout1: .JSB_ENTRY
.
.
JSB Rout2
.
RSB
Rout2: .JSB_ENTRY
.
.
JSB Rout3 ; May return directly to Rout1
.
RSB
Rout3: .JSB_ENTRY
.
.
TSTL (SP)+ ; Discard return address
RSB ; Return to caller’s caller
You could rewrite the code to return a status value, as follows:
Rout2: .JSB_ENTRY
.
.
JSB Rout3
BLBS R0, No_ret ; Check Rout3 status return
RSB ; Return immediately if 0
No_ret: .
.
RSB
Rout3: .JSB_ENTRY
.
.
CLRL R0 ; Specify immediate return from caller
RSB ; Return to caller’s caller
3–10 Recommended and Required Source Changes