FindBugs™ 1.3.9

edu.umd.cs.findbugs.ba.vna
Class ValueNumberAnalysis

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<FrameType>
              extended by edu.umd.cs.findbugs.ba.FrameDataflowAnalysis<ValueNumber,ValueNumberFrame>
                  extended by edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis
All Implemented Interfaces:
DataflowAnalysis<ValueNumberFrame>

public class ValueNumberAnalysis
extends FrameDataflowAnalysis<ValueNumber,ValueNumberFrame>

A dataflow analysis to track the production and flow of values in the Java stack frame. See the ValueNumber class for an explanation of what the value numbers mean, and when they can be compared.

This class is still experimental.

Author:
David Hovemeyer
See Also:
ValueNumber, DominatorsAnalysis

Field Summary
static boolean DEBUG
           
 
Constructor Summary
ValueNumberAnalysis(org.apache.bcel.generic.MethodGen methodGen, DepthFirstSearch dfs, LoadedFieldSet loadedFieldSet, RepositoryLookupFailureCallback lookupFailureCallback)
           
 
Method Summary
 void compactValueNumbers(Dataflow<ValueNumberFrame,ValueNumberAnalysis> dataflow)
          Deprecated. 
 ValueNumberFrame createFact()
          Create empty (uninitialized) dataflow facts for one program point.
 java.util.Iterator<ValueNumberFrame> factIterator()
          Get an Iterator over all dataflow facts that we've recorded for the Locations in the CFG.
 java.lang.String getClassName(ValueNumber v)
           
 ValueNumber getClassObjectValue(java.lang.String className)
           
 ValueNumber getEntryValue(int local)
          Get the value number assigned to the given local variable upon entry to the method.
 ValueNumber getEntryValueForParameter(int param)
          Get the value number assigned to the given parameter upon entry to the method.
 ValueNumberFrame getFactAfterLocation(Location location)
          Get the dataflow fact representing the point just after given Location.
 ValueNumberFrame getFactAtLocation(Location location)
          Get the dataflow fact representing the point just before given Location.
 ValueNumberFactory getFactory()
           
 MergeTree getMergeTree()
           
 int getNumValuesAllocated()
           
 ValueNumber getThisValue()
           
 void initEntryFact(ValueNumberFrame result)
          Initialize the "entry" fact for the graph.
 boolean isThisValue(ValueNumber value)
           
 void meetInto(ValueNumberFrame fact, Edge edge, ValueNumberFrame result)
          Meet a dataflow fact associated with an incoming edge into another fact.
protected  void mergeInto(ValueNumberFrame frame, ValueNumberFrame result)
          Merge one frame into another.
protected  void mergeValues(ValueNumberFrame otherFrame, ValueNumberFrame resultFrame, int slot)
          Merge the values contained in a given slot of two Frames.
 void setMergeTree(MergeTree mergeTree)
           
 void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, ValueNumberFrame fact)
          Transfer function for a single instruction.
 
Methods inherited from class edu.umd.cs.findbugs.ba.FrameDataflowAnalysis
copy, getLastUpdateTimestamp, isFactValid, isTop, makeFactTop, modifyFrame, same, setLastUpdateTimestamp
 
Methods inherited from class edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis
getBlockOrder, getDepthFirstSearch, isForwards
 
Methods inherited from class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis
transfer
 
Methods inherited from class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis
edgeTransfer, factToString, finishIteration, getFactOnEdge, getResultFact, getStartFact, resultFactIterator, startIteration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final boolean DEBUG
Constructor Detail

ValueNumberAnalysis

public ValueNumberAnalysis(org.apache.bcel.generic.MethodGen methodGen,
                           DepthFirstSearch dfs,
                           LoadedFieldSet loadedFieldSet,
                           RepositoryLookupFailureCallback lookupFailureCallback)
Method Detail

getClassObjectValue

public ValueNumber getClassObjectValue(java.lang.String className)

setMergeTree

public void setMergeTree(MergeTree mergeTree)

getMergeTree

public MergeTree getMergeTree()

getFactory

public ValueNumberFactory getFactory()

getNumValuesAllocated

public int getNumValuesAllocated()

isThisValue

public boolean isThisValue(ValueNumber value)

getThisValue

public ValueNumber getThisValue()

getEntryValue

public ValueNumber getEntryValue(int local)
Get the value number assigned to the given local variable upon entry to the method.

Parameters:
local - local variable number
Returns:
ValueNumber assigned to the local variable

getEntryValueForParameter

public ValueNumber getEntryValueForParameter(int param)
Get the value number assigned to the given parameter upon entry to the method.

Parameters:
param - a parameter (0 == first parameter)
Returns:
the ValueNumber assigned to that parameter

createFact

public ValueNumberFrame 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.


initEntryFact

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


transferInstruction

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

Specified by:
transferInstruction in class AbstractDataflowAnalysis<ValueNumberFrame>
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(ValueNumberFrame fact,
                     Edge edge,
                     ValueNumberFrame result)
              throws DataflowAnalysisException
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
Throws:
DataflowAnalysisException

mergeInto

protected void mergeInto(ValueNumberFrame frame,
                         ValueNumberFrame result)
                  throws DataflowAnalysisException
Description copied from class: FrameDataflowAnalysis
Merge one frame into another.

Overrides:
mergeInto in class FrameDataflowAnalysis<ValueNumber,ValueNumberFrame>
Parameters:
frame - the frame to merge with the result
result - the result frame, which is modified to be the merge of the two frames
Throws:
DataflowAnalysisException

mergeValues

protected void mergeValues(ValueNumberFrame otherFrame,
                           ValueNumberFrame resultFrame,
                           int slot)
                    throws DataflowAnalysisException
Description copied from class: FrameDataflowAnalysis
Merge the values contained in a given slot of two Frames.

Specified by:
mergeValues in class FrameDataflowAnalysis<ValueNumber,ValueNumberFrame>
Parameters:
otherFrame - a Frame
resultFrame - a Frame which will contain the resulting merged value
slot - a slot in both frames
Throws:
DataflowAnalysisException

getFactAtLocation

public ValueNumberFrame getFactAtLocation(Location location)
Description copied from class: AbstractDataflowAnalysis
Get the dataflow fact representing the point just before given Location. Note "before" is meant in the logical sense, so for backward analyses, before means after the location in the control flow sense.

Specified by:
getFactAtLocation in interface DataflowAnalysis<ValueNumberFrame>
Overrides:
getFactAtLocation in class AbstractDataflowAnalysis<ValueNumberFrame>
Parameters:
location - the location
Returns:
the fact at the point just before the location

getFactAfterLocation

public ValueNumberFrame getFactAfterLocation(Location location)
Description copied from class: AbstractDataflowAnalysis
Get the dataflow fact representing the point just after given Location. Note "after" is meant in the logical sense, so for backward analyses, after means before the location in the control flow sense.

Specified by:
getFactAfterLocation in interface DataflowAnalysis<ValueNumberFrame>
Overrides:
getFactAfterLocation in class AbstractDataflowAnalysis<ValueNumberFrame>
Parameters:
location - the location
Returns:
the fact at the point just after the location

factIterator

public java.util.Iterator<ValueNumberFrame> factIterator()
Get an Iterator over all dataflow facts that we've recorded for the Locations in the CFG. Note that this does not include result facts (since there are no Locations corresponding to the end of basic blocks).


compactValueNumbers

@Deprecated
public void compactValueNumbers(Dataflow<ValueNumberFrame,ValueNumberAnalysis> dataflow)
Deprecated. 

Compact the value numbers assigned. This should be done only after the dataflow algorithm has executed. This works by modifying the actual ValueNumber objects assigned. After this method is called, the getNumValuesAllocated() method of this object will return a value less than or equal to the value it would have returned before the call to this method.

This method should be called at most once.

Parameters:
dataflow - the Dataflow object which executed this analysis (and has all of the block result values)

getClassName

@CheckForNull
@DottedClassName
public java.lang.String getClassName(ValueNumber v)

FindBugs™ 1.3.9

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