Beispiel #1
0
        void VerifyPages(ObjectLayout.ObjectVisitor objectVisitor)
        {
            UIntPtr page = UIntPtr.Zero;

            while (page < PageTable.pageTableCount)
            {
                UIntPtr startPage = page;
                if (!PageTable.IsMyPage(startPage))
                {
                    page++;
                    continue;
                }
                PageType pageType    = PageTable.Type(page);
                uint     pageProcess = PageTable.Process(page);
                do
                {
                    page++;
                } while (page < PageTable.pageTableCount &&
                         PageTable.Type(page) == pageType &&
                         PageTable.Process(page) == pageProcess);
                UIntPtr endPage = page;
                switch (pageType)
                {
                case PageType.Unallocated:
                case PageType.Unknown:
                case PageType.Shared: {
                    // The region does not belong to us, so there is
                    // nothing to check.
                    break;
                }

                case PageType.UnusedClean:
                case PageType.UnusedDirty: {
                    PageManager.VerifyUnusedRegion(startPage, endPage);
                    break;
                }

                case PageType.System: {
                    // We have looked at the region, but it is off-limits
                    // for the verifier.
                    break;
                }

                case PageType.NonGC: {
                    // Since there may be non-objects in the static data
                    // pages, we cannot apply the heapVerifier to the
                    // region.
                    break;
                }

                case PageType.Stack: {
                    // The page contains (part of) the activation record
                    // stack for one or more threads.
                    break;
                }

                default: {
                    // We have found a data region
                    VTable.Assert(PageTable.IsGcPage(startPage));
                    UIntPtr startAddr = PageTable.PageAddr(startPage);
                    UIntPtr endAddr   = PageTable.PageAddr(endPage);
                    GC.installedGC.VisitObjects(objectVisitor,
                                                startAddr, endAddr);
                    break;
                }
                }
            }
        }