cz.vutbr.fit.findbugs.atom.analysis
Class AtomAnalysis

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<AtomFact>
              extended by cz.vutbr.fit.findbugs.atom.analysis.AtomAnalysis
All Implemented Interfaces:
edu.umd.cs.findbugs.ba.DataflowAnalysis<AtomFact>

public class AtomAnalysis
extends edu.umd.cs.findbugs.ba.ForwardDataflowAnalysis<AtomFact>

Implements control flow analysis which looks for atoms (two consequential accesses to some variable). It uses and detects ConTest methods - access is defined as ConTest method invocation. Information concerning variable and location of an access is based on the parameters of these ConTest methods.

At the end of the analysis, the collection of detected atoms is transformed to AtomicityCollection and is stored into specified XML file.

Author:
zdenek
See Also:
AtomicityCollection

Constructor Summary
AtomAnalysis(edu.umd.cs.findbugs.ba.DepthFirstSearch dfs, org.apache.bcel.classfile.ConstantPool cop, org.apache.bcel.generic.ConstantPoolGen copg)
          Constructor
 
Method Summary
 void copy(AtomFact source, AtomFact dest)
          Copy the content of the fact from the source fact to the destination fact.
 AtomFact createFact()
          Create a new fact.
 java.lang.String factToString(AtomFact fact)
          Returns human readable representation of the fact.
 void initEntryFact(AtomFact result)
          Initiate the fact to the fact which should hold at the start of CFG.
 boolean isFactValid(AtomFact fact)
          Returns true if the fact represents a value which is not TOP (I know nothing) or BOTTOM (error occured).
 boolean isTop(AtomFact fact)
          Returns true if the given fact is TOP.
 void makeFactTop(AtomFact fact)
          Make the fact as TOP - means that at this point we know nothing about the location where this fact takes effect.
 void meetInto(AtomFact fact, edu.umd.cs.findbugs.ba.Edge edge, AtomFact result)
          Key method which takes care of joining facts.
 boolean same(AtomFact fact1, AtomFact fact2)
          Returns true if the given facts are the same with respect to analysis purpose.
 void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, edu.umd.cs.findbugs.ba.BasicBlock basicBlock, AtomFact fact)
          Key method for analysis.
 
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, 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
 

Constructor Detail

AtomAnalysis

public AtomAnalysis(edu.umd.cs.findbugs.ba.DepthFirstSearch dfs,
                    org.apache.bcel.classfile.ConstantPool cop,
                    org.apache.bcel.generic.ConstantPoolGen copg)
Constructor

Parameters:
dfs - Depth First Search dataflow analysis
cop - Constant pool
Method Detail

isFactValid

public boolean isFactValid(AtomFact fact)
Returns true if the fact represents a value which is not TOP (I know nothing) or BOTTOM (error occured).

Specified by:
isFactValid in class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<AtomFact>

transferInstruction

public void transferInstruction(org.apache.bcel.generic.InstructionHandle handle,
                                edu.umd.cs.findbugs.ba.BasicBlock basicBlock,
                                AtomFact fact)
                         throws edu.umd.cs.findbugs.ba.DataflowAnalysisException
Key method for analysis. For each instruction in the given basic block this method is called. It represents the point where the instruction can change the fact. (Implements the LocalGen and LocalKill functions.)

Specified by:
transferInstruction in class edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis<AtomFact>
Throws:
edu.umd.cs.findbugs.ba.DataflowAnalysisException

copy

public void copy(AtomFact source,
                 AtomFact dest)
Copy the content of the fact from the source fact to the destination fact.


createFact

public AtomFact createFact()
Create a new fact. This is the only way how all the facts are made. Some will be initialized by setAsTop, initEntryFact or copy.


initEntryFact

public void initEntryFact(AtomFact result)
                   throws edu.umd.cs.findbugs.ba.DataflowAnalysisException
Initiate the fact to the fact which should hold at the start of CFG.

Throws:
edu.umd.cs.findbugs.ba.DataflowAnalysisException

isTop

public boolean isTop(AtomFact fact)
Returns true if the given fact is TOP.


makeFactTop

public void makeFactTop(AtomFact fact)
Make the fact as TOP - means that at this point we know nothing about the location where this fact takes effect.


meetInto

public void meetInto(AtomFact fact,
                     edu.umd.cs.findbugs.ba.Edge edge,
                     AtomFact result)
              throws edu.umd.cs.findbugs.ba.DataflowAnalysisException
Key method which takes care of joining facts. It takes a fact which is true at the end of previous basic block and allows to change the result fact with respect to edge type.

Throws:
edu.umd.cs.findbugs.ba.DataflowAnalysisException

same

public boolean same(AtomFact fact1,
                    AtomFact fact2)
Returns true if the given facts are the same with respect to analysis purpose.


factToString

public java.lang.String factToString(AtomFact fact)
Returns human readable representation of the fact.

Specified by:
factToString in interface edu.umd.cs.findbugs.ba.DataflowAnalysis<AtomFact>
Overrides:
factToString in class edu.umd.cs.findbugs.ba.BasicAbstractDataflowAnalysis<AtomFact>