soot.jimple.toolkits.pointer
Class CastCheckEliminator

java.lang.Object
  extended by soot.toolkits.scalar.AbstractFlowAnalysis<N,A>
      extended by soot.toolkits.scalar.BranchedFlowAnalysis<Unit,A>
          extended by soot.toolkits.scalar.ForwardBranchedFlowAnalysis
              extended by soot.jimple.toolkits.pointer.CastCheckEliminator

public class CastCheckEliminator
extends ForwardBranchedFlowAnalysis

A flow analysis that detects redundant cast checks.


Field Summary
 
Fields inherited from class soot.toolkits.scalar.BranchedFlowAnalysis
unitToAfterBranchFlow, unitToAfterFallFlow
 
Fields inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
filterUnitToBeforeFlow, graph, unitToBeforeFlow
 
Constructor Summary
CastCheckEliminator(BriefUnitGraph cfg)
           
 
Method Summary
protected  void copy(Object source, Object dest)
          Creates a copy of the source flow object in dest.
protected  Object entryInitialFlow()
          Returns a new, aggressive (local,type) set.
protected  void flowThrough(Object inValue, Unit unit, List outFallValues, List outBranchValues)
          This is the flow function as described in the assignment write-up.
protected  void makeInitialSet()
          Find all the locals of reference type and all the types used in casts to initialize the mapping from locals and types to bits in the bit vector in LocalTypeSet.
protected  void merge(Object in1, Object in2, Object out)
          Compute the merge of the in1 and in2 sets, putting the result into out.
protected  Object newInitialFlow()
          Returns a new, aggressive (local,type) set.
protected  void tagCasts()
          Put the results of the analysis into tags in cast statements.
 
Methods inherited from class soot.toolkits.scalar.ForwardBranchedFlowAnalysis
doAnalysis, isForward
 
Methods inherited from class soot.toolkits.scalar.BranchedFlowAnalysis
getBranchFlowAfter, getFallFlowAfter, getFlowBefore
 
Methods inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
merge, mergeInto, treatTrapHandlersAsEntries
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CastCheckEliminator

public CastCheckEliminator(BriefUnitGraph cfg)
Method Detail

tagCasts

protected void tagCasts()
Put the results of the analysis into tags in cast statements.


makeInitialSet

protected void makeInitialSet()
Find all the locals of reference type and all the types used in casts to initialize the mapping from locals and types to bits in the bit vector in LocalTypeSet.


newInitialFlow

protected Object newInitialFlow()
Returns a new, aggressive (local,type) set.

Specified by:
newInitialFlow in class AbstractFlowAnalysis

flowThrough

protected void flowThrough(Object inValue,
                           Unit unit,
                           List outFallValues,
                           List outBranchValues)
This is the flow function as described in the assignment write-up.

Specified by:
flowThrough in class BranchedFlowAnalysis

copy

protected void copy(Object source,
                    Object dest)
Description copied from class: AbstractFlowAnalysis
Creates a copy of the source flow object in dest.

Specified by:
copy in class AbstractFlowAnalysis

merge

protected void merge(Object in1,
                     Object in2,
                     Object out)
Description copied from class: AbstractFlowAnalysis
Compute the merge of the in1 and in2 sets, putting the result into out. The behavior of this function depends on the implementation ( it may be necessary to check whether in1 and in2 are equal or aliased ). Used by the doAnalysis method.

Specified by:
merge in class AbstractFlowAnalysis

entryInitialFlow

protected Object entryInitialFlow()
Returns a new, aggressive (local,type) set.

Specified by:
entryInitialFlow in class AbstractFlowAnalysis