Class Instruction

    • Field Detail

      • noInstructions

        public static final int[] noInstructions
    • Method Detail

      • isFallThrough

        public boolean isFallThrough()
        Specified by:
        isFallThrough in interface IInstruction
        Returns:
        true if the instruction can "fall through" to the following instruction
      • getBranchTargets

        public int[] getBranchTargets()
        Specified by:
        getBranchTargets in interface IInstruction
        Returns:
        an array containing the labels this instruction can branch to (not including the following instruction if this instruction 'falls through')
      • redirectTargets

        public IInstruction redirectTargets​(int[] targetMap)
        Specified by:
        redirectTargets in interface IInstruction
        Returns:
        an Instruction equivalent to this one but with any branch labels updated by looking them up in the targetMap array
      • getPoppedCount

        public int getPoppedCount()
        Specified by:
        getPoppedCount in interface IInstruction
        Returns:
        the number of values this instruction pops off the working stack
      • getOpcode

        public final short getOpcode()
        Returns:
        the opcode selected for this instruction, or -1 if we don't know it yet
      • getPushedType

        public String getPushedType​(String[] poppedTypesToCheck)
        Computes the type of data pushed onto the stack, or null if none is pushed.
        Specified by:
        getPushedType in interface IInstruction
        Parameters:
        poppedTypesToCheck - the types of the data popped off the stack by this instruction; if poppedTypes is null, then we don't know the incoming stack types and the result of this method may be less accurate
      • getPushedWordSize

        public byte getPushedWordSize()
        Specified by:
        getPushedWordSize in interface IInstruction
        Returns:
        the JVM word size of the value this instruction pushes onto the stack, or 0 if this instruction doesn't push anything onto the stack.
      • visit

        public abstract void visit​(IInstruction.Visitor v)
        Apply a Visitor to this instruction. We invoke the appropriate Visitor method according to the type of this instruction.
        Specified by:
        visit in interface IInstruction
      • clone

        public final Object clone()
        We're immutable so there's no need to clone any Instruction object.
        Overrides:
        clone in class Object