예제 #1
0
                public override void Replay(MergeState merge)
                {
                    if (!merge.IsCommon(from))
                    {
                        return;
                    }

                    SymbolicValue v1target = merge.G1.LookupWithoutManifesting(from, function);
                    SymbolicValue v2target = merge.G2.LookupWithoutManifesting(from, function);

                    if (v1target == null)
                    {
                        // no longer in G1
                        return;
                    }
                    if (v2target == null)
                    {
                        // no longer in G2
                        merge.changed = true; // no longer in result.
                        return;
                    }

                    SymbolicValue rtarget = merge.AddJointEdge(v1target, v2target, function, from);

                    if (rtarget != null && rtarget.UniqueId > merge.lastCommonVariable)
                    {
                        merge.JoinSymbolicValue(v1target, v2target, rtarget);
                    }
                }
예제 #2
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);
        }
예제 #3
0
        public override void Replay(MergeState merge) {
          if (!merge.IsCommon(from)) return;

          SymbolicValue v1target = merge.G1.LookupWithoutManifesting(from,function);
          SymbolicValue v2target = merge.G2.LookupWithoutManifesting(from,function);

          if (v1target == null) {
            // no longer in G1
            return;
          }
          if (v2target == null) {
            // no longer in G2
            merge.changed = true; // no longer in result.
            return;
          }
        
          SymbolicValue rtarget = merge.AddJointEdge(v1target, v2target, function, from);

          if (rtarget != null && rtarget.UniqueId > merge.lastCommonVariable) {
            merge.JoinSymbolicValue(v1target, v2target, rtarget); 
          }
        }
예제 #4
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;
    }