|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.findbugs.ba.bcp.PatternMatcher
public class PatternMatcher
Match a ByteCodePattern against the code of a method, represented by a CFG. Produces some number of ByteCodePatternMatch objects, which indicate how the pattern matched the bytecode instructions in the method.
This code is a hack and should probably be rewritten.
ByteCodePattern
Nested Class Summary | |
---|---|
private class |
PatternMatcher.State
Object representing the current state of the matching algorithm. |
Field Summary | |
---|---|
private CFG |
cfg
|
private org.apache.bcel.generic.ConstantPoolGen |
cpg
|
private static boolean |
DEBUG
|
private DepthFirstSearch |
dfs
|
private DominatorsAnalysis |
domAnalysis
|
private ByteCodePattern |
pattern
|
private java.util.LinkedList<ByteCodePatternMatch> |
resultList
|
private static boolean |
SHOW_WILD
|
private java.util.IdentityHashMap<BasicBlock,BasicBlock> |
visitedBlockMap
|
private ValueNumberDataflow |
vnaDataflow
|
private java.util.LinkedList<BasicBlock> |
workList
|
Fields inherited from interface edu.umd.cs.findbugs.graph.DFSEdgeTypes |
---|
BACK_EDGE, CROSS_EDGE, FORWARD_EDGE, TREE_EDGE, UNKNOWN_EDGE |
Constructor Summary | |
---|---|
PatternMatcher(ByteCodePattern pattern,
ClassContext classContext,
org.apache.bcel.classfile.Method method)
Constructor. |
Method Summary | |
---|---|
private void |
attemptMatch(BasicBlock basicBlock,
BasicBlock.InstructionIterator instructionIterator)
Attempt to begin a match. |
java.util.Iterator<ByteCodePatternMatch> |
byteCodePatternMatchIterator()
Return an Iterator over the ByteCodePatternMatch objects representing successful matches of the ByteCodePattern. |
PatternMatcher |
execute()
Search for examples of the ByteCodePattern. |
private void |
work(PatternMatcher.State state)
Match a sequence of pattern elements, starting at the given one. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final boolean SHOW_WILD
private ByteCodePattern pattern
private CFG cfg
private org.apache.bcel.generic.ConstantPoolGen cpg
private DepthFirstSearch dfs
private ValueNumberDataflow vnaDataflow
private DominatorsAnalysis domAnalysis
private java.util.LinkedList<BasicBlock> workList
private java.util.IdentityHashMap<BasicBlock,BasicBlock> visitedBlockMap
private java.util.LinkedList<ByteCodePatternMatch> resultList
Constructor Detail |
---|
public PatternMatcher(ByteCodePattern pattern, ClassContext classContext, org.apache.bcel.classfile.Method method) throws CFGBuilderException, DataflowAnalysisException
pattern
- the ByteCodePattern to look for examples ofclassContext
- ClassContext for the class to analyzemethod
- the Method to analyze
CFGBuilderException
DataflowAnalysisException
Method Detail |
---|
public PatternMatcher execute() throws DataflowAnalysisException
DataflowAnalysisException
- if the ValueNumberAnalysis did not produce useful
values for the methodpublic java.util.Iterator<ByteCodePatternMatch> byteCodePatternMatchIterator()
private void attemptMatch(BasicBlock basicBlock, BasicBlock.InstructionIterator instructionIterator) throws DataflowAnalysisException
basicBlock
- the basic blockinstructionIterator
- the instruction iterator positioned just before
the first instruction to be matched
DataflowAnalysisException
private void work(PatternMatcher.State state) throws DataflowAnalysisException
DataflowAnalysisException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |