Package soot.jimple.toolkits.pointer
Class CastCheckEliminator
- java.lang.Object
-
- soot.toolkits.scalar.AbstractFlowAnalysis<N,A>
-
- soot.toolkits.scalar.BranchedFlowAnalysis<Unit,A>
-
- soot.toolkits.scalar.ForwardBranchedFlowAnalysis<soot.jimple.toolkits.pointer.LocalTypeSet>
-
- soot.jimple.toolkits.pointer.CastCheckEliminator
-
public class CastCheckEliminator extends ForwardBranchedFlowAnalysis<soot.jimple.toolkits.pointer.LocalTypeSet>
A flow analysis that detects redundant cast checks.
-
-
Field Summary
Fields Modifier and Type Field Description protected soot.jimple.toolkits.pointer.LocalTypeSetemptySet-
Fields inherited from class soot.toolkits.scalar.BranchedFlowAnalysis
unitToAfterBranchFlow, unitToAfterFallFlow
-
Fields inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
filterUnitToBeforeFlow, graph, unitToBeforeFlow
-
-
Constructor Summary
Constructors Constructor Description CastCheckEliminator(BriefUnitGraph cfg)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcopy(soot.jimple.toolkits.pointer.LocalTypeSet s, soot.jimple.toolkits.pointer.LocalTypeSet d)Creates a copy of thesourceflow object indest.protected soot.jimple.toolkits.pointer.LocalTypeSetentryInitialFlow()Returns a new, aggressive (local,type) set.protected voidflowThrough(soot.jimple.toolkits.pointer.LocalTypeSet in, Unit unit, List<soot.jimple.toolkits.pointer.LocalTypeSet> outFallVals, List<soot.jimple.toolkits.pointer.LocalTypeSet> outBranchVals)This is the flow function as described in the assignment write-up.protected voidmakeInitialSet()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 voidmerge(soot.jimple.toolkits.pointer.LocalTypeSet in1, soot.jimple.toolkits.pointer.LocalTypeSet in2, soot.jimple.toolkits.pointer.LocalTypeSet o)Compute the merge of thein1andin2sets, putting the result intoout.protected soot.jimple.toolkits.pointer.LocalTypeSetnewInitialFlow()Returns a new, aggressive (local,type) set.protected voidtagCasts()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
-
Methods inherited from class soot.toolkits.scalar.AbstractFlowAnalysis
getFlowBefore, merge, mergeInto, treatTrapHandlersAsEntries
-
-
-
-
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 soot.jimple.toolkits.pointer.LocalTypeSet newInitialFlow()
Returns a new, aggressive (local,type) set.- Specified by:
newInitialFlowin classAbstractFlowAnalysis<Unit,soot.jimple.toolkits.pointer.LocalTypeSet>
-
flowThrough
protected void flowThrough(soot.jimple.toolkits.pointer.LocalTypeSet in, Unit unit, List<soot.jimple.toolkits.pointer.LocalTypeSet> outFallVals, List<soot.jimple.toolkits.pointer.LocalTypeSet> outBranchVals)This is the flow function as described in the assignment write-up.- Specified by:
flowThroughin classBranchedFlowAnalysis<Unit,soot.jimple.toolkits.pointer.LocalTypeSet>
-
copy
protected void copy(soot.jimple.toolkits.pointer.LocalTypeSet s, soot.jimple.toolkits.pointer.LocalTypeSet d)Description copied from class:AbstractFlowAnalysisCreates a copy of thesourceflow object indest.- Specified by:
copyin classAbstractFlowAnalysis<Unit,soot.jimple.toolkits.pointer.LocalTypeSet>
-
merge
protected void merge(soot.jimple.toolkits.pointer.LocalTypeSet in1, soot.jimple.toolkits.pointer.LocalTypeSet in2, soot.jimple.toolkits.pointer.LocalTypeSet o)Description copied from class:AbstractFlowAnalysisCompute the merge of thein1andin2sets, putting the result intoout. The behavior of this function depends on the implementation ( it may be necessary to check whetherin1andin2are equal or aliased ). Used by the doAnalysis method.- Specified by:
mergein classAbstractFlowAnalysis<Unit,soot.jimple.toolkits.pointer.LocalTypeSet>
-
entryInitialFlow
protected soot.jimple.toolkits.pointer.LocalTypeSet entryInitialFlow()
Returns a new, aggressive (local,type) set.- Overrides:
entryInitialFlowin classAbstractFlowAnalysis<Unit,soot.jimple.toolkits.pointer.LocalTypeSet>
-
-