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));
        }
Exemplo 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));
 }
Exemplo 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));
 }
Exemplo 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());
                }
        }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 7
0
        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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo 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;
 }
Exemplo 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));
        }
Exemplo n.º 13
0
        /// <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);
        }
Exemplo 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));
        }
Exemplo n.º 16
0
 public Serializer(HessianOutput output, TypeBindings typeBindings = null)
 {
     _output       = output ?? throw new ArgumentNullException(nameof(output));
     _typeBindings = typeBindings;
 }
Exemplo n.º 17
0
 public DeserializerSettings()
 {
     TypeBindings = new TypeBindings();
 }
Exemplo 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);
        }