Class PatternMatcher.State

  • Enclosing class:
    PatternMatcher

    private class PatternMatcher.State
    extends java.lang.Object
    Object representing the current state of the matching algorithm. Provides convenient methods to implement the various steps of the algorithm.
    • Method Detail

      • toString

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

        public BasicBlock getBasicBlock()
        Get basic block.
      • getPatternElement

        public PatternElement getPatternElement()
        Get current pattern element.
      • getCurrentMatch

        public PatternElementMatch getCurrentMatch()
        Get current pattern element match.
      • isComplete

        public boolean isComplete()
        Determine if the match is complete.
      • getResult

        public ByteCodePatternMatch getResult()
        Get a ByteCodePatternMatch representing the complete match.
      • advanceToNextElement

        public PatternMatcher.State advanceToNextElement()
        Try to produce a new state that will finish matching the current element and start matching the next element. Returns null if the current element is not complete.
      • currentElementCanContinue

        public boolean currentElementCanContinue()
        Determine if the current pattern element can continue to match instructions.
      • moreInstructionsInBasicBlock

        public boolean moreInstructionsInBasicBlock()
        Determine if there are more instructions in the same basic block.
      • canAdvanceToNextBasicBlock

        public boolean canAdvanceToNextBasicBlock()
        Determine if it is possible to continue matching in a successor basic block.
      • getLastMatchedInstruction

        public org.apache.bcel.generic.InstructionHandle getLastMatchedInstruction()
        Get most recently matched instruction.
      • advanceToSuccessor

        public PatternMatcher.State advanceToSuccessor​(Edge edge,
                                                       MatchResult matchResult)
        Return a new State for continuing the overall pattern match in a successor basic block.
        Parameters:
        edge - the Edge leading to the successor basic block
        matchResult - a MatchResult representing the match of the last instruction in the predecessor block; null if none
      • lookForDominatedInstruction

        public boolean lookForDominatedInstruction()
        Determine if we need to look for a dominated instruction at this point in the search.