Class Subroutine


  • final class Subroutine
    extends java.lang.Object
    A method subroutine (corresponds to a JSR instruction).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.List<JumpInsnNode> callers
      The JSR instructions that jump to this subroutine.
      (package private) boolean[] localsUsed
      The local variables that are read or written by this subroutine.
      (package private) LabelNode start
      The start of this subroutine.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean merge​(Subroutine subroutine)
      Merges the given subroutine into this subroutine.
      • Methods inherited from class java.lang.Object

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

      • start

        final LabelNode start
        The start of this subroutine.
      • localsUsed

        final boolean[] localsUsed
        The local variables that are read or written by this subroutine. The i-th element is true if and only if the local variable at index i is read or written by this subroutine.
      • callers

        final java.util.List<JumpInsnNode> callers
        The JSR instructions that jump to this subroutine.
    • Constructor Detail

      • Subroutine

        Subroutine​(LabelNode start,
                   int maxLocals,
                   JumpInsnNode caller)
        Constructs a new Subroutine.
        Parameters:
        start - the start of this subroutine.
        maxLocals - the local variables that are read or written by this subroutine.
        caller - a JSR instruction that jump to this subroutine.
      • Subroutine

        Subroutine​(Subroutine subroutine)
        Constructs a copy of the given Subroutine.
        Parameters:
        subroutine - the subroutine to copy.
    • Method Detail

      • merge

        public boolean merge​(Subroutine subroutine)
        Merges the given subroutine into this subroutine. The local variables read or written by the given subroutine are marked as read or written by this one, and the callers of the given subroutine are added as callers of this one (if both have the same start).
        Parameters:
        subroutine - another subroutine. This subroutine is left unchanged by this method.
        Returns:
        whether this subroutine has been modified by this method.