public static DependencyGraph BuildFromCallGraph(AssemblyCallGraph assemblyCallGraph)
        {
            Dictionary <Method, DependencyMethod> methodPairs = new Dictionary <Method, DependencyMethod>();

            foreach (var jitType in assemblyCallGraph.Types.Values)
            {
                foreach (var methodGroup in jitType.Methods.Values)
                {
                    foreach (var method in methodGroup.GetAllMethods())
                    {
                        methodPairs.Add(method, CreateMethod(method));
                    }
                }
            }

            RewireCalls(methodPairs);

            return(new DependencyGraph(methodPairs.Values));
        }
Пример #2
0
        public AssemblyCallGraph Run()
        {
            var callGraph = RunJitCompiler(CreateUnorderedController());

            if (_recordEventDetails)
            {
                UnorderedCallGraph = callGraph;
            }

            if (_targetScope != null && _targetScope.ScopeType == ScopeType.Method)
            {
                return(callGraph);
            }

            var dependencyGraph         = DependencyGraphBuilder.BuildFromCallGraph(callGraph);
            DependencyResolver resolver = new DependencyResolver(dependencyGraph);
            var methodList = resolver.GetOrderedMethodList();

            if (methodList.Methods.Count == 0)
            {
                return(callGraph);
            }

            string methodListFile = SerializeMethodList(methodList);

            try
            {
                var orderedCallGraph = RunJitCompiler(CreateOrderedController(methodListFile));
                return(orderedCallGraph);
            }
            finally
            {
                if (File.Exists(methodListFile))
                {
                    File.Delete(methodListFile);
                }
            }
        }