Class CastCheckEliminator


  • public class CastCheckEliminator
    extends ForwardBranchedFlowAnalysis<soot.jimple.toolkits.pointer.LocalTypeSet>
    A flow analysis that detects redundant cast checks.
    • Field Detail

      • emptySet

        protected soot.jimple.toolkits.pointer.LocalTypeSet emptySet
    • 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:
        newInitialFlow in class AbstractFlowAnalysis<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:
        flowThrough in class BranchedFlowAnalysis<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: AbstractFlowAnalysis
        Creates a copy of the source flow object in dest.
        Specified by:
        copy in class AbstractFlowAnalysis<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: 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<Unit,​soot.jimple.toolkits.pointer.LocalTypeSet>
      • entryInitialFlow

        protected soot.jimple.toolkits.pointer.LocalTypeSet entryInitialFlow()
        Returns a new, aggressive (local,type) set.
        Overrides:
        entryInitialFlow in class AbstractFlowAnalysis<Unit,​soot.jimple.toolkits.pointer.LocalTypeSet>