Beispiel #1
0
        internal override bool Scan(NonNullReferenceVisitor visitor)
        {
            bool globalRepeat = false;

            while (true)
            {
                UIntPtr lowAddr, highAddr;
                if (this.destinationLow != this.allocator.AllocPtr)
                {
                    lowAddr             = this.destinationLow;
                    highAddr            = this.allocator.AllocPtr;
                    this.destinationLow = highAddr;
                }
                else if (!this.HaveWork)
                {
                    // No more work to do
                    break;
                }
                else
                {
                    lowAddr = this.GetWork(out highAddr);
                }
                globalRepeat    = true;
                this.sourceHigh = highAddr;
                lowAddr        += PreHeader.Size;
                lowAddr         =
                    BumpAllocator.SkipNonObjectData(lowAddr, highAddr);
                while (lowAddr < this.sourceHigh)
                {
                    Object obj = Magic.fromAddress(lowAddr);
                    lowAddr += visitor.VisitReferenceFields(obj);
                    lowAddr  =
                        BumpAllocator.SkipNonObjectData(lowAddr, highAddr);
                }
                if (lowAddr < highAddr)
                {
                    // The scanning must have been aborted early due to
                    // overflow into a new page.  Put the rest of the
                    // range on the work list.
                    this.AddWork(lowAddr - PreHeader.Size, highAddr);
                }
            }
            return(globalRepeat);
        }
Beispiel #2
0
        internal override bool Scan(NonNullReferenceVisitor visitor)
        {
            bool localRepeat  = false;
            bool globalRepeat = false;

            while (true)
            {
                while (this.HaveWork)
                {
                    localRepeat = true;
                    UIntPtr lowAddr, highAddr;
                    lowAddr  = this.GetWork(out highAddr);
                    lowAddr += PreHeader.Size;
                    lowAddr  =
                        BumpAllocator.SkipNonObjectData(lowAddr, highAddr);
                    while (lowAddr < highAddr)
                    {
                        Object obj = Magic.fromAddress(lowAddr);
                        lowAddr += visitor.VisitReferenceFields(obj);
                        lowAddr  =
                            BumpAllocator.SkipNonObjectData(lowAddr, highAddr);
                    }
                }
                if (this.destinationLow != this.allocator.AllocPtr)
                {
                    localRepeat = true;
                    UIntPtr lowAddr  = this.destinationLow;
                    UIntPtr highAddr = this.allocator.AllocPtr;
                    this.destinationLow = highAddr;
                    this.AddWork(lowAddr, highAddr);
                }
                if (!localRepeat)
                {
                    // Exit the loop if we have done nothing this time around
                    break;
                }
                globalRepeat = true;
                localRepeat  = false;
            }
            return(globalRepeat);
        }
Beispiel #3
0
        void VisitObjects(ObjectLayout.ObjectVisitor objectVisitor,
                          UIntPtr lowAddr, UIntPtr highAddr)
        {
            UIntPtr oldAddr    = UIntPtr.Zero;
            UIntPtr objectAddr = lowAddr + PreHeader.Size;

            objectAddr = BumpAllocator.SkipNonObjectData(objectAddr, highAddr);
            while (objectAddr < highAddr)
            {
                if (PageTable.Page(objectAddr) != PageTable.Page(oldAddr))
                {
                    InteriorPtrTable.VerifyFirst(oldAddr, objectAddr);
                }
                oldAddr = objectAddr;
                Object  obj        = Magic.fromAddress(objectAddr);
                UIntPtr objectSize = objectVisitor.Visit(obj);
                objectAddr += objectSize;
                objectAddr  =
                    BumpAllocator.SkipNonObjectData(objectAddr, highAddr);
            }
            VTable.Assert(objectAddr - PreHeader.Size <= highAddr);
        }
 internal static UIntPtr PtrToNextObject(UIntPtr objPtr, UIntPtr size, UIntPtr limit)
 {
     return(BumpAllocator.SkipNonObjectData(objPtr + size, limit));
 }