Ejemplo n.º 1
0
 public ExprDomain <SymbolicValue> Binary(APC pc, BinaryOperator op, SymbolicValue dest, SymbolicValue s1, SymbolicValue s2, ExprDomain <SymbolicValue> data)
 {
     if (this.truth && op.IsEqualityOperator())
     {
         if (!data.HasRefinement(s1))
         {
             FlatDomain <Expr <SymbolicValue> > expression2 = data [s2];
             if (expression2.IsNormal && !data.IsReachableFrom(s2, s1))
             {
                 return(data.Add(s1, expression2.Concrete));
             }
         }
         else if (!data.HasRefinement(s2))
         {
             FlatDomain <Expr <SymbolicValue> > expression1 = data [s1];
             if (expression1.IsNormal && !data.IsReachableFrom(s1, s2))
             {
                 return(data.Add(s2, expression1.Concrete));
             }
         }
     }
     if (!this.truth && op == BinaryOperator.Cne_Un)
     {
         if (!data.HasRefinement(s1))
         {
             FlatDomain <Expr <SymbolicValue> > expression2 = data [s2];
             if (expression2.IsNormal && !data.IsReachableFrom(s2, s1))
             {
                 return(data.Add(s1, expression2.Concrete));
             }
         }
         else if (!data.HasRefinement(s2))
         {
             FlatDomain <Expr <SymbolicValue> > expression1 = data [s1];
             if (expression1.IsNormal && !data.IsReachableFrom(s1, s2))
             {
                 return(data.Add(s2, expression1.Concrete));
             }
         }
     }
     return(data);
 }
Ejemplo n.º 2
0
        public ExprDomain <SymbolicValue> EdgeConversion(APC @from, APC to, bool isJoinPoint, EdgeData sourceTargetMap, ExprDomain <SymbolicValue> originalState)
        {
            if (sourceTargetMap == null)
            {
                return(originalState);
            }

            if (DebugOptions.Debug)
            {
                Console.WriteLine("====Expression analysis Parallel assign====");
                DumpMap(sourceTargetMap);
                DumpExpressions("original expressions", originalState);
            }

            ExprDomain <SymbolicValue> result = originalState.Empty();
            ExprDomain <SymbolicValue> domain = originalState.Empty();

            foreach (SymbolicValue sv in originalState.Keys)
            {
                Expr <SymbolicValue> expression = originalState [sv].Concrete.Substitute(sourceTargetMap);
                if (expression != null)
                {
                    domain = domain.Add(sv, expression);
                }
            }

            foreach (SymbolicValue sv in sourceTargetMap.Keys)
            {
                FlatDomain <Expr <SymbolicValue> > expressionDomain = domain [sv];
                if (expressionDomain.IsNormal)
                {
                    Expr <SymbolicValue> expression = expressionDomain.Concrete;
                    foreach (SymbolicValue sub in sourceTargetMap[sv].AsEnumerable())
                    {
                        result = result.Add(sub, expression);
                    }
                }
            }

            if (DebugOptions.Debug)
            {
                DumpExpressions("new expressions", result);
            }
            return(result);
        }
Ejemplo n.º 3
0
 public override ExprDomain <TSymValue> Unary(APC pc, UnaryOperator op, bool unsigned, TSymValue dest, TSymValue source, ExprDomain <TSymValue> data)
 {
     return(data.Add(dest, new UnaryExpr <TSymValue> (source, op, unsigned)));
 }
Ejemplo n.º 4
0
 public override ExprDomain <TSymValue> Sizeof(APC pc, TypeNode type, TSymValue dest, ExprDomain <TSymValue> data)
 {
     return(data.Add(dest, new SizeOfExpr <TSymValue> (type)));
 }
Ejemplo n.º 5
0
 public override ExprDomain <TSymValue> LoadNull(APC pc, TSymValue dest, ExprDomain <TSymValue> polarity)
 {
     return(polarity.Add(dest, NullExpr <TSymValue> .Instance));
 }
Ejemplo n.º 6
0
 public override ExprDomain <TSymValue> LoadConst(APC pc, TypeNode type, object constant, TSymValue dest, ExprDomain <TSymValue> data)
 {
     return(data.Add(dest, new ConstExpr <TSymValue> (type, constant)));
 }
Ejemplo n.º 7
0
 public override ExprDomain <TSymValue> Isinst(APC pc, TypeNode type, TSymValue dest, TSymValue obj, ExprDomain <TSymValue> data)
 {
     return(data.Add(dest, new IsInstExpr <TSymValue> (obj, type)));
 }
Ejemplo n.º 8
0
 public override ExprDomain <TSymValue> Binary(APC pc, BinaryOperator op, TSymValue dest, TSymValue operand1, TSymValue operand2, ExprDomain <TSymValue> data)
 {
     return(data.Add(dest, new BinaryExpr <TSymValue> (operand1, operand2, op)));
 }