Class OpcodeStack


  • public class OpcodeStack
    extends java.lang.Object
    tracks the types and numbers of objects that are currently on the operand stack throughout the execution of method. To use, a detector should instantiate one for each method, and call

    stack.sawOpcode(this,seen);

    at the bottom of their sawOpcode method. at any point you can then inspect the stack and see what the types of objects are on the stack, including constant values if they were pushed. The types described are of course, only the static types. There are some outstanding opcodes that have yet to be implemented, I couldn't find any code that actually generated these, so i didn't put them in because I couldn't test them:
    • dup2_x2
    • jsr_w
    • wide
    • Constructor Detail

      • OpcodeStack

        public OpcodeStack()
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasIncomingBranches

        public boolean hasIncomingBranches​(int pc)
      • getExceptionSig

        public static java.lang.String getExceptionSig​(DismantleBytecode dbc,
                                                       org.apache.bcel.classfile.CodeException e)
      • getLastUpdate

        public int getLastUpdate​(int reg)
      • getNumLastUpdates

        public int getNumLastUpdates()
      • clear

        public void clear()
      • printJumpEntries

        public void printJumpEntries()
      • isJumpTarget

        public boolean isJumpTarget​(int pc)
      • initialize

        public void initialize()
      • resetForMethodEntry

        public int resetForMethodEntry​(DismantleBytecode visitor)
      • setJumpInfoChangedByBackwardBranch

        public void setJumpInfoChangedByBackwardBranch​(java.lang.String kind,
                                                       int from,
                                                       int to)
      • getStackDepth

        public int getStackDepth()
      • getNumLocalValues

        public int getNumLocalValues()
      • isTop

        public boolean isTop()
      • isJumpInfoChangedByNewTarget

        protected boolean isJumpInfoChangedByNewTarget()
        Returns:
        Returns the jumpInfoChangedByNewTarget.
      • setJumpInfoChangedByNewTarget

        protected void setJumpInfoChangedByNewTarget()