Esempio n. 1
0
        public IEGraph Join(IEGraph g2, CfgBlock joinPoint, out bool resultIsomorphicToThis)
        {
            IMergeInfo minfo;
            IEGraph    result = Join(g2, joinPoint, out minfo);

            resultIsomorphicToThis = !minfo.Changed;
            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns null, if result of Join is the same as atMerge.
        /// </summary>
        public static ExposureState Join(ExposureState atMerge, ExposureState incoming, CfgBlock joinPoint)
        {
            bool    unchanged;
            IEGraph merged = atMerge.egraph.Join(incoming.egraph, joinPoint, out unchanged);

            TypeNode currentException = (atMerge.currentException != null)?
                                        ((incoming.currentException != null)? CciHelper.LeastCommonAncestor(atMerge.currentException, incoming.currentException) : null) : null;

            if (atMerge.currentException != currentException || !unchanged)
            {
                return(new ExposureState(merged, currentException, atMerge.typeSystem));
            }
            return(null);
        }
Esempio n. 3
0
        public IEGraph Join(IEGraph g2, CfgBlock joinPoint, out IMergeInfo mergeInfo)
        {
            EGraph eg1 = this;
            EGraph eg2 = (EGraph)g2;

            int    updateSize;
            EGraph common = ComputeCommonTail(eg1, eg2, out updateSize);

            EGraph result;
            bool   doReplay = true;

            if (common == null)
            {
                doReplay     = false;
                result       = new EGraph(eg1.elementLattice);
                result.Block = joinPoint;
            }
            else
            {
                result = new EGraph(common, joinPoint);
            }

            if (Analyzer.Debug)
            {
                Console.WriteLine("Last common symbol: {0}", common.idCounter);
            }
            if (Analyzer.Statistics)
            {
                Console.WriteLine("G1:{0} G2:{1} Tail:{2} UpdateSize:{3}", eg1.historySize, eg2.historySize, result.historySize, updateSize);
            }

            MergeState ms = new MergeState(result, eg1, eg2);

            // Heuristic for using Replay vs. full update
            doReplay &= (common != eg1.root);
            doReplay &= (eg1.historySize > 3);
            doReplay &= (eg2.historySize > 3);

            if (doReplay)
            {
                ms.Replay(common);
            }
            else
            {
                ms.AddMapping(eg1.constRoot, eg2.constRoot, result.constRoot);
                ms.JoinSymbolicValue(eg1.constRoot, eg2.constRoot, result.constRoot);
            }
            mergeInfo = ms;
            return(result);
        }
 /// <summary>
 /// Copy Constructor
 /// </summary>
 /// <param name="old"></param>
 public InitializedVariables(InitializedVariables old) {
   this.analyzer = old.analyzer;
   this.egraph = (IEGraph)old.egraph.Clone();
   this.referenceStatus = old.referenceStatus;
 }
 private InitializedVariables(Analyzer analyzer, IEGraph egraph, IMap referenceStatus) {
   this.analyzer = analyzer;
   this.egraph = egraph;
   this.referenceStatus = referenceStatus;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 public InitializedVariables(Analyzer analyzer) {
   this.analyzer = analyzer;
   this.egraph = new EGraph(DefAssignLattice.It);
   this.referenceStatus = new HashedMap();
 }
Esempio n. 7
0
 private ExposureState(IEGraph egraph, TypeNode currentException, TypeSystem t)
 {
     this.typeSystem       = t;
     this.egraph           = egraph;
     this.currentException = currentException;
 }
Esempio n. 8
0
 public ExposureState(TypeSystem t)
 {
     this.typeSystem       = t;
     this.egraph           = new EGraph(Lattice.It);
     this.currentException = null;
 }
Esempio n. 9
0
 public ExposureState(ExposureState old)
 {
     this.typeSystem       = old.typeSystem;
     this.egraph           = (IEGraph)old.egraph.Clone();
     this.currentException = old.currentException;
 }
Esempio n. 10
0
    public IEGraph Join(IEGraph g2, CfgBlock joinPoint, out IMergeInfo mergeInfo) {
      EGraph eg1 = this;
      EGraph eg2 = (EGraph)g2;

      int updateSize;
      EGraph common = ComputeCommonTail(eg1, eg2, out updateSize);

      EGraph result;
      bool doReplay = true;

      if (common == null) {
        doReplay = false;
        result = new EGraph(eg1.elementLattice);
        result.Block = joinPoint;
      }
      else {
        result = new EGraph(common, joinPoint);
      }

      if (Analyzer.Debug) {
        Console.WriteLine("Last common symbol: {0}", common.idCounter);
      }
      if (Analyzer.Statistics) {
        Console.WriteLine("G1:{0} G2:{1} Tail:{2} UpdateSize:{3}", eg1.historySize, eg2.historySize, result.historySize, updateSize);
      }

      MergeState ms = new MergeState(result, eg1, eg2);

      // Heuristic for using Replay vs. full update
      doReplay &= (common != eg1.root);
      doReplay &= (eg1.historySize > 3);
      doReplay &= (eg2.historySize > 3);

      if (doReplay) {
        ms.Replay(common);
      }
      else {
        ms.AddMapping(eg1.constRoot, eg2.constRoot, result.constRoot);
        ms.JoinSymbolicValue(eg1.constRoot, eg2.constRoot, result.constRoot);
      }
      mergeInfo = ms;
      return result;
    }
Esempio n. 11
0
 public IEGraph Join(IEGraph g2, CfgBlock joinPoint, out bool resultIsomorphicToThis) {
   IMergeInfo minfo;
   IEGraph result = Join(g2, joinPoint, out minfo);
   resultIsomorphicToThis = !minfo.Changed;
   return result;
 }
 private ExposureState(IEGraph egraph, TypeNode currentException, TypeSystem t) {
   this.typeSystem = t;
   this.egraph = egraph;
   this.currentException = currentException;
 }
 public ExposureState(TypeSystem t) {
   this.typeSystem = t;
   this.egraph = new EGraph(Lattice.It);
   this.currentException = null;
 }
 public ExposureState(ExposureState old){
   this.typeSystem = old.typeSystem;
   this.egraph = (IEGraph)old.egraph.Clone();  
   this.currentException = old.currentException;
 }
Esempio n. 15
0
    public NonNullState(TypeSystem t, IDelayInfo ieinfo) {
      this.typeSystem = t;
      this.egraph = new EGraph(Lattice.It);
      this.currentException = null;
      existDelayInfo = ieinfo;

      // materialize the null symbol early on so 
      // all derived states share it.
      ISymValue nullsym = this.Null;
    }
Esempio n. 16
0
 public NonNullState(NonNullState old){
   this.typeSystem = old.typeSystem;
   this.egraph = (IEGraph)old.egraph.Clone();  
   this.currentException = old.currentException;
   // this.existDelayInfo = old.ExistDelayInfo;
 }