edu.umd.cs.findbugs.ba
Class LockAnalysis

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

public class LockAnalysis
extends ForwardDataflowAnalysis<LockSet>

Analysis to determine where particular values are locked in a method. The dataflow values are maps of value numbers to the number of times those values are locked.

Author:
David Hovemeyer
See Also:
ValueNumberAnalysis

Field Summary
private static boolean DEBUG
           
private  boolean isStatic
           
private  boolean isSynchronized
           
private  org.apache.bcel.generic.MethodGen methodGen
           
private  ValueNumberAnalysis vna
           
private  ValueNumberDataflow vnaDataflow
           
 
Constructor Summary
LockAnalysis(org.apache.bcel.generic.MethodGen methodGen, ValueNumberDataflow vnaDataflow, DepthFirstSearch dfs)
           
 
Method Summary
 void copy(LockSet source, LockSet dest)
          Copy dataflow facts.
 LockSet createFact()
          Create empty (uninitialized) dataflow facts for one program point.
 void initEntryFact(LockSet result)
          Initialize the "entry" fact for the graph.
 void initResultFact(LockSet result)
          Initialize result fact for block.
 boolean isFactValid(LockSet fact)
          Determine whether the given fact is valid (neither top nor bottom).
private static void lockOp(LockSet fact, int lockNumber, int delta)
           
static void main(java.lang.String[] argv)
           
 void makeFactTop(LockSet fact)
          Make given fact the top value.
 void meetInto(LockSet fact, Edge edge, LockSet result)
          Meet a dataflow fact associated with an incoming edge into another fact.
 boolean same(LockSet fact1, LockSet fact2)
          Are given dataflow facts the same?
 void transferInstruction(org.apache.bcel.generic.InstructionHandle handle, BasicBlock basicBlock, LockSet 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
endTransfer, factToString, getFactAfterLocation, getFactAtLocation, getResultFact, getStartFact, resultFactIterator, startTransfer, transfer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG

methodGen

private org.apache.bcel.generic.MethodGen methodGen

vnaDataflow

private ValueNumberDataflow vnaDataflow

vna

private ValueNumberAnalysis vna

isSynchronized

private boolean isSynchronized

isStatic

private boolean isStatic
Constructor Detail

LockAnalysis

public LockAnalysis(org.apache.bcel.generic.MethodGen methodGen,
                    ValueNumberDataflow vnaDataflow,
                    DepthFirstSearch dfs)
Method Detail

createFact

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


copy

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


initEntryFact

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


initResultFact

public void initResultFact(LockSet result)
Description copied from interface: DataflowAnalysis
Initialize result fact for block. The start facts for a block are initialized as the meet of the "logical" predecessor's result facts. Note that a "logical predecessor" is actually a CFG successor if the analysis is backwards.


makeFactTop

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


same

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


meetInto

public void meetInto(LockSet fact,
                     Edge edge,
                     LockSet 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

transferInstruction

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

Specified by:
transferInstruction in class AbstractDataflowAnalysis<LockSet>
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

lockOp

private static void lockOp(LockSet fact,
                           int lockNumber,
                           int delta)

isFactValid

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

Specified by:
isFactValid in class AbstractDataflowAnalysis<LockSet>

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Throws:
java.lang.Exception