RunDisjunctionRecoveryAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>
        (
            string methodName,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
            Predicate <APC> cachePCs
        )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
        {
            Contract.Requires(driver != null);

            var analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .DisjunctionsRecoveryAnalysis
                    (methodName, driver, cachePCs);

            var closure = driver.HybridLayer.CreateForward <TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .DisjunctiveRefinement>(
                analysis,
                new DFAOptions {
                Trace = driver.Options.TraceDFA, Timeout = driver.Options.Timeout, EnforceFairJoin = driver.Options.EnforceFairJoin, IterationsBeforeWidening = driver.Options.IterationsBeforeWidening, TraceTimePerInstruction = driver.Options.TraceTimings, TraceMemoryPerInstruction = driver.Options.TraceMemoryConsumption
            });

            closure(analysis.GetTopValue()); // Do the analysis

            analysis.ClearCaches();

            return(new SyntacticInformation <Method, Field, Variable>(analysis, analysis.Tests, analysis.RightExpressions, analysis.FirstViewAt, analysis.MayUpdateFields, analysis.MethodCalls, analysis.liveVariablesInRenamings, analysis.RenamingsLength, analysis.HasThrow, analysis.HasExceptionHandlers));
        }
Esempio n. 2
0
 public static Data <Variable> FindMethodExtractMarkers <Local, Parameter, Method, Field, Property, Event, Typ, Attribute, Assembly, Expression, Variable>(IMethodDriver <Local, Parameter, Method, Field, Property, Event, Typ, Attribute, Assembly, Expression, Variable, ILogOptions> mdriver)
     where Typ : IEquatable <Typ>
     where Expression : IEquatable <Expression>
     where Variable : IEquatable <Variable>
 {
     return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Typ, Attribute, Assembly, Expression, Variable> .RunTheAnalysis(mdriver));
 }
Esempio n. 3
0
 public static ContractDensity GetContractDensity <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>(
     IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver
     )
     where Expression : IEquatable <Expression>
     where Variable : IEquatable <Variable>
     where Type : IEquatable <Type>
 {
     return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .GetContractDensity(driver));
 }
Esempio n. 4
0
        private static byte[] Serialize(object obj, TypeBindings bindings = null)
        {
            using (var ms = new MemoryStream())
                using (var writer = new HessianStreamWriter(ms))
                {
                    new HessianOutputV1(writer, bindings ?? TypeBindings.Java).WriteObject(obj);

                    return(ms.ToArray());
                }
        }
 public static IMethodResult <Variable> AnalyzeStrings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable>
     (string methodName,
     IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> driver, IValueAnalysisOptions options)
     where Variable : IEquatable <Variable>
     where ExternalExpression : IEquatable <ExternalExpression>
     where Type : IEquatable <Type>
 {
     // We call the helper as a syntactic convenience, as there are too many type parameters!
     return(TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable> .HelperForStringAnalysis(methodName, driver, options));
 }
 /// <summary>
 /// The entry point for running the arithmetic analysis
 /// </summary>
 public static IMethodResult <Variable> RunTheArithmeticAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>
 (
     string methodName,
     IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
     ADomainKind adomain, Analyzers.Arithmetic.ArithmeticOptions options,
     Predicate <APC> cachePCs
 )
     where Variable : IEquatable <Variable>
     where Expression : IEquatable <Expression>
     where Type : IEquatable <Type>
 {
     return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .HelperForRunTheArithmeticAnalysis(methodName, adomain, driver, options, cachePCs));
 }
        RunPartitionAnalysis <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable>
        (
            string methodName,
            IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> driver,
            List <Analyzers.Containers.ContainerOptions> options,
            IFactQuery <BoxedExpression, Variable> factQuery)
            where Variable : IEquatable <Variable>
            where ExternalExpression : IEquatable <ExternalExpression>
            where Type : IEquatable <Type>
        {
            //var analysis =
            // new TypeBindings<Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable>.PartitionAnalysis(methodName, driver, options);

            return(TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable> .HelperForPartitionAnalysis(methodName, driver, options, factQuery));
        }
Esempio n. 8
0
        /// <summary>
        /// Entry point to run the container analysis
        /// </summary>
        public static IMethodResult <Variable> RunContainerAnalysis <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable>
        (
            string methodName,
            IMethodDriver <APC, Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable, ILogOptions> driver,
            TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable> .PartitionAnalysis partitions,
            List <Analyzers.Containers.ContainerOptions> options)
            where Variable : IEquatable <Variable>
            where ExternalExpression : IEquatable <ExternalExpression>
            where Type : IEquatable <Type>
        {
            var analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable> .ContainerAnalysis(methodName, driver, partitions, options);

            return(TypeBindings <Local, Parameter, Method, Field, Property, Type, Attribute, Assembly, ExternalExpression, Variable> .RunTheAnalysis(methodName, driver, analysis));
        }
Esempio n. 9
0
        /// <summary>
        /// Entry point to run the Buffer analysis
        /// </summary>
        public static IMethodResult <Variable> RunBufferAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>
        (
            string methodName,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
            List <Analyzers.Buffers.Options> options,
            Predicate <APC> cachePCs, DFAController controller
        )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
        {
            var analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .BufferAnalysis(methodName, driver, options, cachePCs, controller);

            return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .RunTheAnalysis(methodName, driver, analysis, controller));
        }
Esempio n. 10
0
        RunTheAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, Options>
        (
            string methodName,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
            List <Options> options,
            Predicate <APC> cachePCs
        )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
            where Options : Analyzers.ValueAnalysisOptions <Options>
        {
            var analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .NumericalAnalysis <Options>(methodName, driver, options, cachePCs);

            return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .RunTheAnalysis(methodName, driver, analysis));
        }
Esempio n. 11
0
 public void Initialize(
     HttpClient httpClient,
     Uri endpoint,
     TypeBindings typeBindings       = null,
     ProtocolVersion protocolVersion = ProtocolVersion.V2,
     bool unwrapServiceExceptions    = true)
 {
     /*
      * Initialize is required because this instance is created
      * by `DispatchProxy.Create` which requries an empty constructor.
      */
     _httpClient             = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _endpoint               = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
     _protocolVersion        = protocolVersion;
     _unwrapServiceException = unwrapServiceExceptions;
     _typeBindings           = typeBindings;
 }
Esempio n. 12
0
        /// <summary>
        /// Entry point to run the Enum analysis
        /// </summary>
        public static IMethodResult <Variable> RunEnumAnalysis <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable>
        (
            string methodName,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver,
            List <Analyzers.Enum.Options> options,
            Predicate <APC> cachePCs, DFAController controller
        )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
        {
            Contract.Requires(driver != null);
            Contract.Requires(options != null);
            Contract.Requires(options.Count > 0);

            var analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .EnumAnalysis
                    (methodName, driver, options[0], cachePCs);

            return(TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable> .RunTheAnalysis(methodName, driver, analysis, controller));
        }
        /// <summary>
        /// Create a hessian service proxy for the provided type <typeparamref name="T"/>.
        /// </summary>
        /// <typeparam name="T">
        /// The hessian service type.
        /// </typeparam>
        /// <param name="httpClient">
        /// The client used to communicate with the hessian remote endpoint.
        /// </param>
        /// <param name="endpoint">
        /// The service endpoint.
        /// </param>
        /// <param name="protocolVersion">
        /// The hessian version that should be used to serialize the hessian request.
        /// </param>
        /// <param name="unwrapServiceExceptions">
        /// Indicates whether service exceptions are thrown directly without wrapping them
        /// into <see cref="HessianRemoteException"/>.
        /// </param>
        /// <param name="typeBindings">
        /// Custom type bindings
        /// </param>
        /// <returns>
        /// Returns the created hessian service.
        /// </returns>
        public static T HessianService <T>(
            this HttpClient httpClient,
            Uri endpoint,
            TypeBindings typeBindings       = null,
            ProtocolVersion protocolVersion = ProtocolVersion.V2,
            bool unwrapServiceExceptions    = true)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }
            if (endpoint == null)
            {
                throw new ArgumentNullException(nameof(endpoint));
            }

            var proxy = DispatchProxy.Create <T, HessianProxy>();

            ((HessianProxy)(object)proxy).Initialize(httpClient, endpoint, typeBindings, protocolVersion, unwrapServiceExceptions);
            return(proxy);
        }
Esempio n. 14
0
 public Deserializer(HessianInput input, TypeBindings typeBindings = null)
 {
     _input        = input ?? throw new ArgumentNullException(nameof(input));
     _typeBindings = typeBindings;
 }
        public static void Analyze <Label, Local, Parameter, Method, Field, Type, Expression, Variable>(
            IMethodDriver <Label, Local, Parameter, Method, Field, Type, Expression, Variable> driver,
            bool doDebug
            )
            where Variable : IEquatable <Variable>
        {
            TypeBindings <Label, Local, Parameter, Method, Field, Type, Expression, Variable> .Analysis analysis =
                new TypeBindings <Label, Local, Parameter, Method, Field, Type, Expression, Variable> .Analysis(driver.MetaDataDecoder);

            analysis.Debug = doDebug;
            driver.CreateForward(analysis, doDebug)(analysis.InitialValue(driver.KeyNumber));
        }
Esempio n. 16
0
 public Serializer(HessianOutput output, TypeBindings typeBindings = null)
 {
     _output       = output ?? throw new ArgumentNullException(nameof(output));
     _typeBindings = typeBindings;
 }
 public DeserializerSettings()
 {
     TypeBindings = new TypeBindings();
 }
Esempio n. 18
0
        /// <summary>
        /// Main interface method of the analyzer. It returns state machine information, given a method driver.
        /// </summary>
        /// <param name="fullMethodName">The name of the method, should always be "MoveNext".</param>
        /// <param name="driver">A method analysis driver.</param>
        /// <returns></returns>
        public StateMachineInformation <Local> AnalyzeMoveNext <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions>(
            string fullMethodName,
            IMethodDriver <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> driver
            )
            where Variable : IEquatable <Variable>
            where Expression : IEquatable <Expression>
            where Type : IEquatable <Type>
            where ILogOptions : IFrameworkLogOptions
        {
            TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> .Analysis analysis =
                new TypeBindings <Local, Parameter, Method, Field, Property, Event, Type, Attribute, Assembly, Expression, Variable, ILogOptions> .Analysis(driver, this);

            driver.ValueLayer.CreateForward(analysis, new DFAOptions {
            })(analysis.InitialValue());
            return(analysis.MoveNextPreAnalysisResult);
        }