FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba
Class StackDepthAnalysis

java.lang.Object
  extended by edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<Fact>
      extended by edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<Fact>
          extended by edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<StackDepth>
              extended by edu.umd.cs.findbugs.ba.StackDepthAnalysis
All Implemented Interfaces:
DataflowAnalysis<StackDepth>

public class StackDepthAnalysis
extends ForwardDataflowAnalysis<StackDepth>

A really simple forward dataflow analysis to find the depth of the Java operand stack. This is more of a proof of concept for the dataflow analysis framework than anything useful.

See Also:
Dataflow, DataflowAnalysis

Field Summary
static int BOTTOM
           
static int TOP
           
 
Constructor Summary
StackDepthAnalysis(org.apache.bcel.generic.ConstantPoolGen cpg, DepthFirstSearch dfs)
          Constructor.
 
Method Summary
 void copy(StackDepth source, StackDepth dest)
          Copy dataflow facts.
 StackDepth createFact()
          Create empty (uninitialized) dataflow facts for one program point.
 void initEntryFact(StackDepth entryFact)
          Initialize the "entry" fact for the graph.
 boolean isFactValid(StackDepth fact)
          Determine whether the given fact is valid (neither top nor bottom).
 boolean isTop(StackDepth fact)
          Is the given fact the top value.
 void makeFactTop(StackDepth fact)
          Make given fact the top value.
 void meetInto(StackDepth fact, Edge edge, StackDepth result)
          Meet a dataflow fact associated with an incoming edge into another fact.
 boolean same(StackDepth fact1, StackDepth fact2)
          Are given dataflow facts the same?
 void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, StackDepth fact)
          Transfer function for a single instruction.
 
Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis
getBlockOrder, getDepthFirstSearch, isForwards
 
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
getFactAfterLocation, getFactAtLocation, transfer
 
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
edgeTransfer, factToString, finishIteration, getFactOnEdge, getLastUpdateTimestamp, getResultFact, getStartFact, resultFactIterator, setLastUpdateTimestamp, startIteration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP

public static final int TOP
See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
See Also:
Constant Field Values
Constructor Detail

StackDepthAnalysis

public StackDepthAnalysis(org.apache.bcel.generic.ConstantPoolGen cpg,
                          DepthFirstSearch dfs)
Constructor.

Parameters:
cpg - the ConstantPoolGen of the method whose CFG we're performing the analysis on
dfs - DepthFirstSearch of the method's CFG
Method Detail

createFact

public StackDepth createFact()
Description copied from interface: DataflowAnalysis
Create empty (uninitialized) dataflow facts for one program point. A valid value will be copied into it before it is used.


makeFactTop

public void makeFactTop(StackDepth fact)
Description copied from interface: DataflowAnalysis
Make given fact the top value.


isTop

public boolean isTop(StackDepth fact)
Description copied from interface: DataflowAnalysis
Is the given fact the top value.


isFactValid

public boolean isFactValid(StackDepth fact)
Description copied from class: AbstractDataflowAnalysis
Determine whether the given fact is valid (neither top nor bottom).

Specified by:
isFactValid in class AbstractDataflowAnalysis<StackDepth>

copy

public void copy(StackDepth source,
                 StackDepth dest)
Description copied from interface: DataflowAnalysis
Copy dataflow facts.


initEntryFact

public void initEntryFact(StackDepth entryFact)
Description copied from interface: DataflowAnalysis
Initialize the "entry" fact for the graph.


same

public boolean same(StackDepth fact1,
                    StackDepth fact2)
Description copied from interface: DataflowAnalysis
Are given dataflow facts the same?


transferInstruction

public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
                                BasicBlock basicBlock,
                                StackDepth fact)
                         throws DataflowAnalysisException
Description copied from class: AbstractDataflowAnalysis
Transfer function for a single instruction.

Specified by:
transferInstruction in class AbstractDataflowAnalysis<StackDepth>
Parameters:
handle - the instruction
basicBlock - the BasicBlock containing the instruction; needed to disambiguate instructions in inlined JSR subroutines
fact - which should be modified based on the instruction
Throws:
DataflowAnalysisException

meetInto

public void meetInto(StackDepth fact,
                     Edge edge,
                     StackDepth result)
Description copied from interface: DataflowAnalysis
Meet a dataflow fact associated with an incoming edge into another fact. This is used to determine the start fact for a basic block.

Parameters:
fact - the predecessor fact (incoming edge)
edge - the edge from the predecessor
result - the result fact

FindBugs™ 1.3.9

FindBugs™ is licenced under the LGPL. Copyright © 2006 University of Maryland.