User`s guide

How the MACRO Compiler Functions on Different Platforms
2.5 Declaring JSB Routine Entry Points
2.5.2 Two General Cases for Using .JSB32_ENTRY
There are two general cases where you can use .JSB32_ENTRY:
• If a user-mode application or self-contained subsystem is written entirely in
Macro-32 you can use .JSB32_ENTRY throughout the application.
• If you have one major Macro-32 routine that is called from another language
or from any source which requires 64-bit register preservation, and that
routine calls several other Macro-32 routines, you can set a barrier of 64-bit
preservation. You can do this by using .JSB_ENTRY or .CALL_ENTRY on the
major routine and preserving all registers that are not explicit outputs. The
internal subroutines can then use the .JSB32_ENTRY directive.
Note that it is not sufficient to just use .JSB_ENTRY or .CALL_ENTRY for
the barrier without explicitly preserving all registers, since by default the
compiler will only save and restore the registers that are explicitly modified
in the major routine. The internal subroutines that use .JSB32_ENTRY may
then modify registers that are not being preserved. You must also make sure
that none of the internal subroutines can be called in any way that bypasses
the barrier.
Caution
The .JSB32_ENTRY directive can be a great time-saver if you are sure
that you can use it. If you use .JSB32_ENTRY in a situation where the
upper 32 bits of a register are being used, it may cause very obscure and
difficult-to-track bugs by corrupting a 64-bit value that may be several
calling levels above the offending routine.
.JSB32_ENTRY should never be used in an AST routine, condition
handler, or any other code that can be executed asynchronously.
2.5.3 PUSHR and POPR Instructions Within JSB Routines
There will be cases when you add a .JSB_ENTRY directive to a routine which
already saves/restores some registers by means of PUSHR/POPR. Depending on
routine usage, some registers may end up being saved/restored twice, once by the
compiler and again by the PUSHR/POPR. Do not attempt to optimize this unless
the code is extremely performance sensitive. The compiler attempts to detect this
and eliminate the redundant save/restores.
2.5.4 Establishing Dynamic Condition Handlers in JSB Routines
The compiler will flag, as illegal, any code in a .JSB_ENTRY routine that
attempts to modify 0(FP).
2.6 Declaring a Routine’s Register Use
The compiler provides four register declaration arguments that you can specify
in a .CALL_ENTRY, .JSB_ENTRY, .JSB32_ENTRY, .CALL_LINKAGE (OpenVMS
I64 only), .USE_LINKAGE (OpenVMS I64 only), or .DEFINE_LINKAGE
(OpenVMS I64 only) entry-point directive:
• Input
• Output
• Scratch
2–12 How the MACRO Compiler Functions on Different Platforms