/// <summary> /// Construct an empty abstract domain of symbolic expressions /// </summary> public SymbolicExpressionsAbstractDomain(IExpressionDecoder <Expression> decoder, IExpressionEncoder <Expression> encoder) { this.decoder = decoder; this.encoder = encoder; this.var2exp = new SimpleFunctional <Expression, FlatAbstractDomainWithComparer <Expression> >(); InitStaticFields(); }
/// <summary> /// Initialize the static fields, if they are not already initialized /// </summary> private void InitStaticFields() { Debug.Assert(this.encoder != null && this.decoder != null, "At this point I already need a decoder and an encoder"); // Check if we have already initialized all the maps if (cachedTopMap != null && cachedBottomExpression != null && cachedTopExpression != null) { return; } Expression dummyForTop = this.encoder.FreshVariable <int>(); FlatAbstractDomainWithComparer <Expression> topVal = (FlatAbstractDomainWithComparer <Expression>) new FlatAbstractDomainWithComparer <Expression>(dummyForTop, null).Top; cachedTopMap = new SimpleFunctional <Expression, FlatAbstractDomainWithComparer <Expression> >(); cachedTopMap.Add(dummyForTop, topVal); cachedBottomExpression = (FlatAbstractDomainWithComparer <Expression>)topVal.Bottom; cachedTopExpression = topVal; }
private SymbolicExpressionsAbstractDomain(FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> > var2exp, IExpressionDecoder <Expression> decoder, IExpressionEncoder <Expression> encoder) { this.decoder = decoder; this.encoder = encoder; this.var2exp = var2exp; }
private SymbolicExpressionsAbstractDomain(SymbolicExpressionsAbstractDomain <Expression> s) { this.decoder = s.decoder; this.encoder = s.encoder; this.var2exp = s.var2exp; }
public object /*!*/ Clone() { FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> > clonedVar2exp = (FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> >) this.var2exp.Clone(); return(new SymbolicExpressionsAbstractDomain <Expression>(clonedVar2exp, this.decoder, this.encoder)); }
public IAbstractDomain /*!*/ Meet(IAbstractDomain /*!*/ a) { IAbstractDomain trivialMeet; if (AbstractDomainsHelper.TryTrivialMeet(this, a, out trivialMeet)) { return(trivialMeet); } Debug.Assert(a is SymbolicExpressionsAbstractDomain <Expression>, "Expecting an instance of SymbolicExpressionsAbstractDomain. Found " + a); //^ assert a is SymbolicExpressionsAbstractDomain<Expression>; SymbolicExpressionsAbstractDomain <Expression> right = a as SymbolicExpressionsAbstractDomain <Expression>; FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> > meetSymbolicExpressions = (FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> >) this.var2exp.Meet(right.var2exp); // Meet the symbolic expression bindings Debug.Assert(!meetSymbolicExpressions.IsTop, "The meet of two non-top expression environments cannot be top "); // ^ assert !joinSymbolicExpressions.IsTop; if (meetSymbolicExpressions.IsBottom) { return(this.Bottom); } else { return(new SymbolicExpressionsAbstractDomain <Expression>(meetSymbolicExpressions, this.decoder, this.encoder)); } }
public IAbstractDomain /*!*/ Join(IAbstractDomain /*!*/ a) { IAbstractDomain /*!*/ result; if (AbstractDomainsHelper.TryTrivialJoin(this, a, out result)) { return(result); } Debug.Assert(a is SymbolicExpressionsAbstractDomain <Expression>, "Expecting an instance of SymbolicExpressionsAbstractDomain. Found " + a); //^ assert a is SymbolicExpressionsAbstractDomain<Expression>; SymbolicExpressionsAbstractDomain <Expression> right = a as SymbolicExpressionsAbstractDomain <Expression>; FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> > joinSymbolicExpressions = (FunctionalAbstractDomain <Expression, FlatAbstractDomainWithComparer <Expression> >) this.var2exp.Join(right.var2exp); // Join the symbolic expression bindings Debug.Assert(!joinSymbolicExpressions.IsBottom, "The join of two non-bottom expression environments cannot be bottom"); //^ assert !joinSymbolicExpressions.IsBottom; /* * if (joinSymbolicExpressions.IsTop) * { * return this.Top; * } * else * {*/ return(new SymbolicExpressionsAbstractDomain <Expression>(joinSymbolicExpressions, this.decoder, this.encoder)); //} }