LONGJMP : Long-Jump
PLONGJMP : Pre-Long-Jump

Format

SPA 5.0:
                   PLONGJMP   #OffsetS24              {&req_6}   {?sched}           ;   
                   PLONGJMP   c[#BankU05][#AddrU16]   {&req_6}   {?sched}           ;   // This form is not patchable and is deprecated   

        {@{!}Pg}   LONGJMP    {CC.test}               {&req_6}   {?sched>=?WAIT5}   ;   


  .test:  { .F,      .LT,     .EQ,     .LE,      .GT,      .NE,      .GE,   .NUM,     Signed numeric tests
            .NAN,    .LTU,    .EQU,    .LEU,     .GTU,     .NEU,     .GEU,  .T*,      Signed or Unordered tests 
            .OFF,    .LO,     .SFF,    .LS,      .HI,      .SFT,     .HS,   .OFT,     Unsigned integer tests
            .CSM_TA, .CSM_TR, .CSM_MX, .FCSM_TA, .FCSM_TR, .FCSM_MX, .RLE,  .RGT  }   Clip State Machine tests

Description

Together, PLONGJMP and LONGJMP implement one step of the stack unwind mechanism used to implement setjump and longjmp.

PLONGJMP:

Set program pre-longjmp synchronization point.

This instruction is used before (and outside) a routine that calls setjmp. It specifies the target address for execution to resume at after the LONGJMP.

The target address is relative to the program counter of the instruction following the PLONGJMP instruction, and is a signed byte address with the two lsbs being 0.

The PLONGJMP instruction results in a token being pushed onto the CallReturnStack (CRS) but does not alter the program flow, execution continues normally to the next sequential instruction.

LONGJMP:

The long jump condition is based on a predicate AND condition code bits. To just long jump on predicate, use CC.TRUE. To just long jump on CC, use PT.

When all active threads have executed a LONGJMP, the stack will be unwound until a matching PLONGJMP token is found. The PLONGJMP stack entry will be popped from the stack and execution will resume at the address specified by the PLONGJMP, with the active mask updated according to the mask in the PLONGJMP. Thus making this a synchronizing event.

LONGJMP can be executed within any arbitrarily nested control structure, and will jump to the nearest enclosing PLONGJMP point. Thus it provides one level of stack unwinding. Together with some additional code, arbitrary-depth stack unwinding can be implemented.

A LONGJMP without a matching PLONGJMP will result in an error.

Examples:

     PLONGJMP       LABEL0;
     NOP;
     LONGJMP        CC.EQ;      // Executes if CC.EQ condition evaluates to TRUE

LABEL0:                         // Program execution resumes here after LONGJMP execution

Back to Index of Instructions