Class Opcode


public class Opcode extends PatternElement
PatternElement to match instructions with a particular opcode.
Author:
David Hovemeyer
See Also:
  • Constructor Details

    • Opcode

      public Opcode(int opcode)
      Constructor.
      Parameters:
      opcode - the opcode to match
  • Method Details

    • match

      public MatchResult match(org.apache.bcel.generic.InstructionHandle handle, org.apache.bcel.generic.ConstantPoolGen cpg, ValueNumberFrame before, ValueNumberFrame after, BindingSet bindingSet) throws DataflowAnalysisException
      Description copied from class: PatternElement
      Return whether or not this element matches the given instruction with the given Bindings in effect.
      Specified by:
      match in class PatternElement
      Parameters:
      handle - the instruction
      cpg - the ConstantPoolGen from the method
      before - the ValueNumberFrame representing values in the Java stack frame just before the execution of the instruction
      after - the ValueNumberFrame representing values in the Java stack frame just after the execution of the instruction
      bindingSet - the set of Bindings
      Returns:
      if the match is successful, returns a MatchResult with the PatternElement and BindingSet; if the match is not successful, returns null
      Throws:
      DataflowAnalysisException
    • acceptBranch

      public boolean acceptBranch(Edge edge, org.apache.bcel.generic.InstructionHandle source)
      Description copied from class: PatternElement
      Return whether or not it is acceptable to take the given branch.
      Specified by:
      acceptBranch in class PatternElement
      Parameters:
      edge - the Edge representing the branch
      source - the source instruction of the branch
      Returns:
      true if the Edge is acceptable, false if not
    • minOccur

      public int minOccur()
      Description copied from class: PatternElement
      Return the minimum number of instructions this PatternElement must match in the ByteCodePattern.
      Specified by:
      minOccur in class PatternElement
    • maxOccur

      public int maxOccur()
      Description copied from class: PatternElement
      Return the maximum number of instructions this PatternElement must match in the ByteCodePattern.
      Specified by:
      maxOccur in class PatternElement