public AnnotatedAssemblyHolder(AssemblyHolder sourceHolder, WhiteList whiteList) : base(sourceHolder) { this.aMethods = new Hashtable(); this.GraphProcessor = new GraphProcessor(); this.WhiteList = whiteList; foreach (MethodBase method in this.SourceHolder.getMethods()) if (method.IsDefined(typeof(SpecializeAttribute), false)) ControllingVisitor.AddAnnotatedMethodUser(this.AnnotateMethod(this.GetAnnotatedMethod(method))); this.GraphProcessor.Process(); }
static void Evaluate() { WhiteList whiteList = new WhiteList(); whiteList.AddFromXml("wlist.xml"); if (showProgress) Console.WriteLine("White list reading - OK"); Assembly assembly = Assembly.LoadFrom(sourceAssemblyName); AssemblyHolder srcHolder = new AssemblyHolder(assembly); if (showProgress) Console.WriteLine("Source assembly reading - OK"); if (showSourceCFG) { Console.WriteLine("\nSource CFG:\n----------\n"); Console.Write(srcHolder); } markTime(); AnnotatedAssemblyHolder btaHolder = new AnnotatedAssemblyHolder(srcHolder, whiteList); btaTime = getSpan(); if (showProgress) Console.WriteLine("Assembly annotation - OK"); if (showAnnotatedCFG) { Console.WriteLine("\nAnnotated CFG:\n-------------\n"); Console.Write(btaHolder.ToString("CSharp",ReflectionFormatter.formatter,new string[] { Annotation.BTTypeOption, Annotation.MethodBTTypeOption })); } markTime(); ResidualAssemblyHolder resHolder = new ResidualAssemblyHolder(btaHolder); specTime = getSpan(); if (showProgress) Console.WriteLine("Assembly specialization - OK"); if (showResidualCFG) { Console.WriteLine("\nResidual CFG:\n-------------\n"); Console.Write(resHolder.ToString("CSharp",ReflectionFormatter.formatter)); } if (enablePostprocessing) { markTime(); resHolder.Optimize(); pprocTime = getSpan(); if (showProgress) Console.WriteLine("Assembly postprocessing - OK"); if (showPostprocessedCFG) { Console.WriteLine("\nPostprocessed CFG:\n-----------------\n"); Console.Write(resHolder.ToString("CSharp",ReflectionFormatter.formatter)); } } Exporter.Export(resHolder, targetAssemblyName); if (showProgress) Console.WriteLine("Assembly export - OK"); if (enableClock) { Console.WriteLine("Timings:"); Console.WriteLine(" BTA - " + btaTime); Console.WriteLine(" Specializer - " + specTime); if (enablePostprocessing) Console.WriteLine(" Postprocessing - " + pprocTime); } }