Exemplo n.º 1
0
 public virtual Mutator Cast(SortMapping target)
 {
     if (target == GetSortMapping())
     {
         return(this);
     }
     throw new SymbolicExplorationException("Cast from " + GetSortMapping() + " to " + target + " undefined");
 }
Exemplo n.º 2
0
        // The following functions lift functions on Z3 expressions to functions on Mutators

        Func <Mutator, Mutator> LiftZ3Op1 <TOp1Expr, TReturnExpr>(Func <TOp1Expr, TReturnExpr> z3Constructor, Func <TReturnExpr, Mutator> mutatorConstructor,
                                                                  SortMapping op1Mapping)
            where TOp1Expr : Expr
            where TReturnExpr : Expr
        {
            return((op1) =>
            {
                var v1 = op1.Cast(op1Mapping);
                try
                {
                    return mutatorConstructor(z3Constructor((TOp1Expr)v1.CreateUpdate()));
                }
                catch (InvalidCastException)
                {
                    throw new SymbolicExplorationException("SortMapping does not match sort of Z3 constructor");
                }
            });
        }
Exemplo n.º 3
0
        public override Mutator Cast(SortMapping target)
        {
            var intTarget = target as IntSortMapping;

            if (intTarget != null)
            {
                if (intTarget == _sortMapping)
                {
                    return(this);
                }
                else if (intTarget.Sort.Size > Size)
                {
                    return(new IntMutator(intTarget,
                                          IsSigned ? Ctx.MkSignExt(intTarget.Sort.Size - Size, Value) : Ctx.MkZeroExt(intTarget.Sort.Size - Size, Value)));
                }
                else
                {
                    return(new IntMutator(intTarget, Ctx.MkExtract(intTarget.Sort.Size - 1, 0, Value)));
                }
            }
            return(base.Cast(target));
        }
 public PureExplorationState(PureExplorationState toClone)
     : base(toClone)
 {
     _returnType = toClone._returnType;
 }
 public PureExplorationState(CompilationInfo info, BasicBlock programLocation, SortMapping returnType, IDictionary <ISymbol, Mutator> parameters, Expr[] boundVariables = null)
     : base(info, programLocation, parameters, boundVariables == null ? new Expr[0] : boundVariables)
 {
     _returnType = returnType;
 }