com.saxonica.bytecode.util

## Class OnEmpty.UnwindAndJump

- java.lang.Object
- - com.saxonica.bytecode.util.OnEmpty
  - - com.saxonica.bytecode.util.OnEmpty.UnwindAndJump

- Enclosing class:
    OnEmpty

      public static class OnEmpty.UnwindAndJump
      extends OnEmpty

  The UnwindAndJump subclass causes the code generator, when an expression evaluates to the empty sequence, to generate a "goto" instruction to a defined label; but before executing the jump, the stack will be unwound to a known position.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.saxonica.bytecode.util.OnEmpty

      `OnEmpty.ReturnEmptyString, OnEmpty.ReturnNull, OnEmpty.UnwindAndJump`

  - ### Field Summary

    - ### Fields inherited from class com.saxonica.bytecode.util.OnEmpty

      `RETURN_EMPTY_STRING, RETURN_NULL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OnEmpty.UnwindAndJump(LabelInfo label)` Generate an UnwindAndStack action using an empty stack (no unwinding needed)
    `OnEmpty.UnwindAndJump(Stack<Class> unwindStack, LabelInfo label)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `generate(Generator ga)` Generate code.
    `LabelInfo` | `getLabel()` Get the label acting as the jump destination
    `Stack<Class>` | `getUnwindStack()` Get information about the stack that needs to be unwound before making the jump.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OnEmpty.UnwindAndJump

          public OnEmpty.UnwindAndJump(Stack<Class> unwindStack,
                               LabelInfo label)

      Parameters:
        `unwindStack` - Information about the classes of object that will be on the bytecode stack and must be popped off the stack before jumping to the onEmpty label: the generated code must pop the items described on this stack before jumping to the label.
        `label` - a label to which control will be transferred (with nothing on the stack) if the result of the evaluation is an empty sequence. This mechanism supports the design pattern whereby many expressions return empty if one of there arguments is empty; rather than repeatedly checking for empty after evaluating each subexpression, there is a "longjump" treating this as an exception case.

    - #### OnEmpty.UnwindAndJump

          public OnEmpty.UnwindAndJump(LabelInfo label)

      Generate an UnwindAndStack action using an empty stack (no unwinding needed)
      Parameters:
        `label` - the label to jump to

  - ### Method Detail

    - #### generate

          public void generate(Generator ga)

      Generate code. (This method is not extensively used)
      Specified by:
        `generate` in class `OnEmpty`
      Parameters:
        `ga` - the code generator

    - #### getLabel

          public LabelInfo getLabel()

      Get the label acting as the jump destination
      Returns:
        the label

    - #### getUnwindStack

          public Stack<Class> getUnwindStack()

      Get information about the stack that needs to be unwound before making the jump. This contains information about the class of object at each position, because doubles and longs occupy two words and need a pop2 instruction to remove them
      Returns:
        details of the stack to be unwound

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.