Ejemplo n.º 1
0
        public IEnumerable <IEnumerable <int> > GenerateBucketsBasedOnVisibility()
        {
            var bucketsCounts    = new int[this.methodNumbers.Count];
            var methodsInABucket = new List <Method>();

            foreach (var m in this.methodNumbers.OrderedMethods())
            {
                if (metadataDecoder.IsVisibleOutsideAssembly(m) && metadataDecoder.HasBody(m))
                {
                    var currentBucket  = new Set <Method>();
                    var currentNumbers = new List <int>();
                    // Get the bucket containing the cone for this method
                    var bucket = methodNumbers.GetMethodBucket(m);

                    // Remember we saw those methods
                    methodsInABucket.AddRange(bucket);

                    // Add the method number to the current numbers
                    currentNumbers.Add(this.methodNumbers.GetMethodNumber(m));

                    // Add the bucket to the current methods
                    currentBucket.AddRange(bucket);

                    // If we passed the threshold, then schedule for analysis
                    if (currentBucket.Count >= this.bucketSize)
                    {
                        bucketsCounts[currentBucket.Count]++;

                        yield return(currentNumbers);
                    }
                }
                else
                {
                    // skip them for now...
                }
            }

            var methodsNotInABucket = this.methodNumbers.OrderedMethods().Where(m => metadataDecoder.HasBody(m)).Except(methodsInABucket);
            var count = methodsNotInABucket.Count();

            if (count > 0)
            {
                Console.WriteLine("*** There are {0} methods not in a bucket from externally visible surface", count);

                yield return(methodsNotInABucket.Select(m => this.methodNumbers.GetMethodNumber(m)));
            }
            else
            {
                Console.WriteLine("*** All the methods are reachable from the outside");
            }
        }
Ejemplo n.º 2
0
        protected void AddMethod(Method method)
        {
            // Make sure node is in graph
            this.callGraph.AddNode(method);

            // visit the method body
            if (md.HasBody(method))
            {
                md.AccessMethodBody(method, this, Unit.Value);
            }
            methodCount++;
        }