Ejemplo n.º 1
0
        public static void RunAbstractInterpretation(Program program)
        {
            Contract.Requires(program != null);

            if (!CommandLineOptions.Clo.UseAbstractInterpretation)
            {
                return;
            }
            Helpers.ExtraTraceInformation("Starting abstract interpretation");

            DateTime start = new DateTime(); // to please compiler's definite assignment rules

            if (CommandLineOptions.Clo.Trace)
            {
                Console.WriteLine();
                Console.WriteLine("Running abstract interpretation...");
                start = DateTime.UtcNow;
            }

            WidenPoints.Compute(program);

            NativeLattice lattice = null;

            if (CommandLineOptions.Clo.Ai.J_Trivial)
            {
                lattice = new TrivialDomain();
            }
            else if (CommandLineOptions.Clo.Ai.J_Intervals)
            {
                lattice = new NativeIntervallDomain();
            }

            if (lattice != null)
            {
                Dictionary <Procedure, Implementation[]> procedureImplementations = ComputeProcImplMap(program);
                ComputeProgramInvariants(program, procedureImplementations, lattice);
                if (CommandLineOptions.Clo.Ai.DebugStatistics)
                {
                    Console.Error.WriteLine(lattice);
                }
            }

            if (CommandLineOptions.Clo.Trace)
            {
                DateTime end     = DateTime.UtcNow;
                TimeSpan elapsed = end - start;
                Console.WriteLine("  [{0} s]", elapsed.TotalSeconds);
                Console.Out.Flush();
            }
        }
Ejemplo n.º 2
0
        public static void RunAbstractInterpretation(Program program)
        {
            Contract.Requires(program != null);

              if (!CommandLineOptions.Clo.UseAbstractInterpretation) {
            return;
              }
              Helpers.ExtraTraceInformation("Starting abstract interpretation");

              DateTime start = new DateTime();  // to please compiler's definite assignment rules
              if (CommandLineOptions.Clo.Trace) {
            Console.WriteLine();
            Console.WriteLine("Running abstract interpretation...");
            start = DateTime.UtcNow;
              }

              WidenPoints.Compute(program);

              NativeLattice lattice = null;
              if (CommandLineOptions.Clo.Ai.J_Trivial) {
            lattice = new TrivialDomain();
              } else if (CommandLineOptions.Clo.Ai.J_Intervals) {
            lattice = new NativeIntervallDomain();
              }

              if (lattice != null) {
            Dictionary<Procedure, Implementation[]> procedureImplementations = ComputeProcImplMap(program);
            ComputeProgramInvariants(program, procedureImplementations, lattice);
            if (CommandLineOptions.Clo.Ai.DebugStatistics) {
              Console.Error.WriteLine(lattice);
            }
              }

              if (CommandLineOptions.Clo.Trace) {
            DateTime end = DateTime.UtcNow;
            TimeSpan elapsed = end - start;
            Console.WriteLine("  [{0} s]", elapsed.TotalSeconds);
            Console.Out.Flush();
              }
        }