Package gnu.bytecode

Class ExitableBlock


  • public class ExitableBlock
    extends java.lang.Object
    Support for code block that one may be exited. You may optionally exit with a value, and/or run intervening finally blocks.

    Typical usage::

     CodeAttr code = ...;
     Type retType = ...; // a Type or null
     ExitableBlock block = code.startExitableBlock(retType, true);
     ...
     ... block.exit() ...; // conditionally
     ...
     code.endExitableBlock();
     

    The block.exit() compiles to a transfer to the end of the block, executing any finally-blocks within the block that surround the call to exit.

    If the ExitableBlock should leave a result on the stack, then specify the type of the result as the retType. The block itself must push a result before calling endExitableBlock (unless code.reachableHere() is false), and must also push a result before block.exit()..

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void exit()
      Exit this surrounding block, executing finally blocks as needed.
      Label exitIsGoto()
      If an exit is simple, return the label for block end.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • exit

        public void exit()
        Exit this surrounding block, executing finally blocks as needed. Return a value as the result of this ExitableBlock.
      • exitIsGoto

        public Label exitIsGoto()
        If an exit is simple, return the label for block end. The exit is simple if there is no intervening finally blocks.