private void ApplyInvariants(ref HoudiniOutcome outcome) { if (this.Houdini != null) { Houdini.ApplyAssignment(this.PostAC.Program, outcome); // this.Houdini.ApplyAssignment(this.PostAC.Program); this.Houdini.Close(); WhoopCruncherCommandLineOptions.Get().TheProverFactory.Close(); } }
public void Run() { this.AC.EliminateDeadVariables(); this.AC.Inline(); if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine(" |------ [{0}]", this.EP.Name); Console.WriteLine(" | |"); this.Timer = new ExecutionTimer(); this.Timer.Start(); } HoudiniOutcome outcome = null; this.PerformHoudini(ref outcome); this.ApplyInvariants(ref outcome); this.AC.ResetToProgramTopLevelDeclarations(); ModelCleaner.RemoveGenericTopLevelDeclerations(this.PostAC, this.EP); ModelCleaner.RemoveUnusedTopLevelDeclerations(this.AC); ModelCleaner.RemoveGlobalLocksets(this.PostAC); ModelCleaner.RemoveExistentials(this.PostAC); if (!(WhoopCruncherCommandLineOptions.Get().InliningBound > 0 && this.AC.GetNumOfEntryPointRelatedFunctions(this.EP.Name) <= WhoopCruncherCommandLineOptions.Get().InliningBound)) { ModelCleaner.RemoveWhoopFunctions(this.PostAC); ModelCleaner.RemoveConstants(this.PostAC); ModelCleaner.RemoveImplementations(this.PostAC); } if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { this.Timer.Stop(); Console.WriteLine(" | |"); Console.WriteLine(" | |--- [Total] {0}", this.Timer.Result()); Console.WriteLine(" |"); } Whoop.IO.BoogieProgramEmitter.Emit(this.PostAC.TopLevelDeclarations, WhoopCruncherCommandLineOptions.Get().Files[ WhoopCruncherCommandLineOptions.Get().Files.Count - 1], this.EP.Name + "$summarised", "wbpl"); }
public static void Main(string[] args) { Contract.Requires(cce.NonNullElements(args)); CommandLineOptions.Install(new WhoopCruncherCommandLineOptions()); WhoopCruncherCommandLineOptions.Get().PrintUnstructured = 2; try { WhoopCruncherCommandLineOptions.Get().RunningBoogieFromCommandLine = true; if (!WhoopCruncherCommandLineOptions.Get().Parse(args)) { Environment.Exit((int)Outcome.FatalError); } if (WhoopCruncherCommandLineOptions.Get().Files.Count == 0) { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: no input files were specified"); Environment.Exit((int)Outcome.FatalError); } List <string> fileList = new List <string>(); foreach (string file in WhoopCruncherCommandLineOptions.Get().Files) { string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } fileList.Add(file); } foreach (string file in fileList) { Contract.Assert(file != null); string extension = Path.GetExtension(file); if (extension != null) { extension = extension.ToLower(); } if (extension != ".bpl") { Whoop.IO.Reporter.ErrorWriteLine("Whoop: error: {0} is not a .bpl file", file); Environment.Exit((int)Outcome.FatalError); } } DeviceDriver.ParseAndInitialize(fileList); Summarisation.SummaryInformationParser.FromFile(fileList); ExecutionTimer timer = null; if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { Console.WriteLine("\n[Cruncher] runtime"); Console.WriteLine(" |"); timer = new ExecutionTimer(); timer.Start(); } var alreadyCrunched = new HashSet <string>(); foreach (var ep in DeviceDriver.EntryPoints) { if (!Summarisation.SummaryInformationParser.AvailableSummaries.Contains(ep.Name)) { continue; } if (alreadyCrunched.Contains(ep.Name)) { continue; } AnalysisContext ac = null; AnalysisContext acPost = null; new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl").TryParseNew( ref ac, new List <string> { ep.Name + "$instrumented" }); new AnalysisContextParser(fileList[fileList.Count - 1], "wbpl").TryParseNew( ref acPost, new List <string> { ep.Name + "$instrumented" }); new InvariantInferrer(ac, acPost, ep).Run(); alreadyCrunched.Add(ep.Name); } if (WhoopCruncherCommandLineOptions.Get().MeasurePassExecutionTime) { timer.Stop(); Console.WriteLine(" |"); Console.WriteLine(" |--- [Total] {0}", timer.Result()); } Environment.Exit((int)Outcome.Done); } catch (Exception e) { Console.Error.Write("Exception thrown in Whoop: "); Console.Error.WriteLine(e); Environment.Exit((int)Outcome.FatalError); } }