Example #1
0
        internal static void Initialize()
        {
            // The card table covers all the heap. Below is not accurate heap
            // size. It includes all the memory space, starting from address 0.
            // TODO: find more accurate heap size and start

            UIntPtr heapSize = PageTable.pageTableCount * PageTable.PageSize;

            VTable.Assert((heapSize >> CardBits) << CardBits == heapSize,
                          "Assumption: pageSize is expected to be multiple of CardSize");
            UIntPtr heapStart = (UIntPtr)0;

            totalCards  = heapSize >> CardBits;
            firstCardNo = heapStart >> CardBits;

            UIntPtr tablePtr = PageManager.AllocateNonheapMemory(null, totalCards);

            VTable.Assert(tablePtr != UIntPtr.Zero);
            cardTablePtr  = (byte *)tablePtr;
            cardTableBase = (byte *)(tablePtr - firstCardNo);

            CardTable.instance = (CardTable)
                                 BootstrapMemory.Allocate(typeof(CardTable));

            OffsetTable.Initialize(totalCards);

            for (UIntPtr c = firstCardNo; c < firstCardNo + totalCards; c++)
            {
                VTable.Assert(!CardIsDirty(c), "Card table initialization error");
            }
        }
 public static new void Initialize()
 {
     ConcurrentMSCollector.InitializeAllButVisitors();
     // instance = new CoCoMSCollector();
     ConcurrentMSCollector.instance
           = CoCoMSCollector.instance
           = (CoCoMSCollector)
             BootstrapMemory.Allocate(typeof(CoCoMSCollector));
     ConcurrentMSCollector.markReferenceVisitor =
         (MarkReferenceVisitor)
         BootstrapMemory.Allocate(typeof(MarkAndForwardReferenceVisitor));
     CoCoMSCollector.normalStackMarker =
         (NonNullReferenceVisitor)
         BootstrapMemory.Allocate(typeof(StackForwardReferenceVisitor));
     CoCoMSCollector.pinStackMarker =
         (NonNullReferenceVisitor)
         BootstrapMemory.Allocate(typeof(StackMarkPinnedReferenceVisitor));
     CoCoMSCollector.nopStackMarker =
         (NonNullReferenceVisitor)
         BootstrapMemory.Allocate(typeof(StackNopReferenceVisitor));
     ConcurrentMSCollector.stackMarkReferenceVisitor =
         CoCoMSCollector.normalStackMarker;
     ConcurrentMSCollector.stackMarkPinnedReferenceVisitor =
         CoCoMSCollector.normalStackMarker;
     ConcurrentMSCollector.updateReferenceVisitor =
         (UpdateReferenceVisitor)
         BootstrapMemory.Allocate(typeof(UpdateAndForwardReferenceVisitor));
     ConcurrentMSCollector.partialFreePageVisitor =
         (SegregatedFreeList.PartialFreePageVisitor)
         BootstrapMemory.Allocate(typeof(TaggingPartialFreePageVisitor));
     // sweepVisitor = new SweepVisitor();
     sweepVisitor = (SweepVisitor)
                    BootstrapMemory.Allocate(typeof(SweepVisitor));
 }
Example #3
0
 internal static new void Initialize()
 {
     if (WriteBarrierCMS.instance == null)
     {
         WriteBarrierCMS.instance = (WriteBarrierCMS)
                                    BootstrapMemory.Allocate(typeof(WriteBarrierCMS));
     }
 }
Example #4
0
 public static new void Initialize()
 {
     GenerationalCollector.Initialize();
     SemispaceCollector.Initialize();
     SlidingCollector.Initialize();
     // instance = new AdaptiveCopyingCollector();
     instance = (AdaptiveCopyingCollector )
                BootstrapMemory.Allocate(typeof(AdaptiveCopyingCollector));
 }
Example #5
0
        public static void Initialize()
        {
            Object plcLinkObj = BootstrapMemory.Allocate(typeof(PLCLink));

            firstPLCLink =
                (PLCLink *)(Magic.addressOf(plcLinkObj) + PostHeader.Size);
            plcListVtable     = ((RuntimeType)typeof(PLCLink[])).classVtable;
            plcListChunkBytes =
                ObjectLayout.ArraySize(plcListVtable, plcListChunkLength);
        }
        public static new void Initialize()
        {
            GenerationalCollector.Initialize();
            // copyScanners = new CopyScan[MAX_GENERATION+1];
            copyScanners = (CopyScan[])
                           BootstrapMemory.Allocate(typeof(CopyScan[]),
                                                    (uint)MAX_GENERATION + 1);
            for (int i = (int)MIN_GENERATION; i <= (int)MAX_GENERATION; i++)
            {
                switch (GC.copyscanType)
                {
                case CopyScanType.CheneyScan: {
                    copyScanners[i] = (CopyScan)
                                      BootstrapMemory.Allocate(typeof(CheneyScan));
                    break;
                }

                case CopyScanType.HierarchicalScan: {
                    copyScanners[i] = (CopyScan)
                                      BootstrapMemory.Allocate(typeof(HierarchicalScan));
                    break;
                }

                case CopyScanType.NestedHierarchicalScan: {
                    copyScanners[i] = (CopyScan)
                                      BootstrapMemory.Allocate(typeof(NestedHierarchicalScan));
                    break;
                }

                default: {
                    VTable.NotReached("Unknown CopyScan type: " +
                                      GC.copyscanType);
                    break;
                }
                }
                copyScanners[i].Initialize((PageType)i);
            }
            // SemispaceCollector.instance = new SemispaceCollector();
            SemispaceCollector.instance = (SemispaceCollector)
                                          BootstrapMemory.Allocate(typeof(SemispaceCollector));
            // generalReferenceVisitor = new ForwardReferenceVisitor();
            SemispaceCollector.generalReferenceVisitor = (ForwardReferenceVisitor)
                                                         BootstrapMemory.Allocate(typeof(ForwardReferenceVisitor));
            // threadReferenceVisitor = new ForwardThreadReference(generalReferenceVisitor);
            SemispaceCollector.threadReferenceVisitor = (ForwardThreadReference)
                                                        BootstrapMemory.Allocate(typeof(ForwardThreadReference));
            // pinnedReferenceVisitor = new RegisterPinnedReference();
            SemispaceCollector.pinnedReferenceVisitor = (RegisterPinnedReference)
                                                        BootstrapMemory.Allocate(typeof(RegisterPinnedReference));
            // forwardOnlyReferenceVisitor = new ForwardOnlyReferenceVisitor();
            SemispaceCollector.forwardOnlyReferenceVisitor = (ForwardOnlyReferenceVisitor)
                                                             BootstrapMemory.Allocate(typeof(ForwardOnlyReferenceVisitor));
        }
Example #7
0
        internal static new void Initialize()
        {
            if (fDietDebug)
            {
                VTable.DebugPrint("Diet DoCo!\n");
            }

            ProbabilisticCoCoBarrier.instance =
                (ProbabilisticCoCoBarrier)
                BootstrapMemory.Allocate(typeof(ProbabilisticCoCoBarrier));
            ProbabilisticCoCoBarrier.instance.InitEarly();
            LowAbortCoCoBarrier.Initialize();
        }
        internal static void Initialize(int count, UIntPtr size)
        {
            writeBufferSize = ((int)size * count) / UIntPtr.Size;
            chunkSize       = (int)size;
            UIntPtr memorySize = (UIntPtr)UIntPtr.Size * (uint)writeBufferSize;

            writeBuffer = (UIntPtr *)
                          PageManager.AllocateNonheapMemory(null, memorySize);
            VTable.Assert(writeBuffer != null);
            AdjustChunkSize(1);
            SequentialStoreBuffer.instance = (SequentialStoreBuffer)
                                             BootstrapMemory.Allocate(typeof(SequentialStoreBuffer));
        }
Example #9
0
        public new static void Initialize()
        {
            RCCollector.Initialize();

            if (VerificationMode)
            {
                backupInit =
                    (BackupInitializer)BootstrapMemory.
                    Allocate(typeof(BackupInitializer));
                backupRefCount =
                    (BackupRefCount)BootstrapMemory.
                    Allocate(typeof(BackupRefCount));
                incrementBackupRefCount =
                    (IncrementBackupRefCount)BootstrapMemory.
                    Allocate(typeof(IncrementBackupRefCount));
                rootsScanner =
                    (RootsScanner)BootstrapMemory.
                    Allocate(typeof(RootsScanner));
                resetRoots =
                    (ResetRoots)BootstrapMemory.
                    Allocate(typeof(ResetRoots));
                resetTraversal =
                    (ResetTraversal)BootstrapMemory.
                    Allocate(typeof(ResetTraversal));

                leakAccumulator =
                    (LeakAccumulator)BootstrapMemory.
                    Allocate(typeof(LeakAccumulator));
                leakedNodesDFS =
                    (LeakedNodesDFS)BootstrapMemory.
                    Allocate(typeof(LeakedNodesDFS));
                leakedCycleClosure =
                    (LeakedCycleClosure)BootstrapMemory.
                    Allocate(typeof(LeakedCycleClosure));
                dfsMarker =
                    (DFSMarker)BootstrapMemory.
                    Allocate(typeof(DFSMarker));
                cycleClosure =
                    (CycleClosure)BootstrapMemory.
                    Allocate(typeof(CycleClosure));
                bfsMarker =
                    (BFSMarker)BootstrapMemory.
                    Allocate(typeof(BFSMarker));
                leakedRoots =
                    (LeakedRoots)BootstrapMemory.
                    Allocate(typeof(LeakedRoots));
                leakedRootsCounter =
                    (LeakedRootsCounter)BootstrapMemory.
                    Allocate(typeof(LeakedRootsCounter));
            }
        }
Example #10
0
      public new static void Initialize() {
          SingleThreadedRCCollector.Initialize();

          incrementer =
              (RefCountIncrementer)BootstrapMemory.
              Allocate(typeof(RefCountIncrementer));
          decrementer =
              (RefCountDecrementer)BootstrapMemory.
              Allocate(typeof(RefCountDecrementer));

          instance =
              (ARCSCollector)BootstrapMemory.
              Allocate(typeof(ARCSCollector));
      }
Example #11
0
 public static unsafe void Initialize()
 {
     internalIncrementer =
         (InternalIncrementer)BootstrapMemory.
         Allocate(typeof(InternalIncrementer));
     internalDecrementer =
         (InternalDecrementer)BootstrapMemory.
         Allocate(typeof(InternalDecrementer));
     internalScanner =
         (InternalScanner)BootstrapMemory.
         Allocate(typeof(InternalScanner));
     internalReclaimer =
         (InternalReclaimer)BootstrapMemory.
         Allocate(typeof(InternalReclaimer));
 }
Example #12
0
        internal static new void Initialize()
        {
            if (gcCountTable != null)
            {
                return;
            }
            StopTheWorldCollector.Initialize();
            defaultGeneration = MAX_GENERATION;
            uint tableSize = (uint)MAX_GENERATION + 1;

            nurserySize = (UIntPtr)(1 << 24);
            // gcCountTable = new short[MAX_GENERATION+1];
            gcCountTable = (short[])
                           BootstrapMemory.Allocate(typeof(short[]), tableSize);
            // gcFrequencyTable = new short[MAX_GENERATION+1];
            gcFrequencyTable = (short[])
                               BootstrapMemory.Allocate(typeof(short[]), tableSize);
            // gcPromotedTable = new UIntPtr[MAX_GENERATION+1];
            gcPromotedTable = (UIntPtr[])
                              BootstrapMemory.Allocate(typeof(UIntPtr[]), tableSize);
            // gcPromotedLimitTable = new UIntPtr[MAX_GENERATION+1];
            gcPromotedLimitTable = (UIntPtr[])
                                   BootstrapMemory.Allocate(typeof(UIntPtr[]), tableSize);
            pretenuredSinceLastFullGC = UIntPtr.Zero;
            // fromSpacePageCounts = new int[MAX_GENERATION+1];
            fromSpacePageCounts = (int[])
                                  BootstrapMemory.Allocate(typeof(int[]),
                                                           (uint)MAX_GENERATION + 1);

            MinGenPage = (UIntPtr[])
                         BootstrapMemory.Allocate(typeof(UIntPtr[]),
                                                  (uint)MAX_GENERATION + 1);
            MaxGenPage = (UIntPtr[])
                         BootstrapMemory.Allocate(typeof(UIntPtr[]),
                                                  (uint)MAX_GENERATION + 1);


            // Initialization of tables
            // gcFrequencyTable and gcPromotedLimitTable may be modified by
            // VTable.ParseArgs
            gcFrequencyTable[(int)MIN_GENERATION]     = Int16.MaxValue;
            gcPromotedLimitTable[(int)MIN_GENERATION] = (UIntPtr)1 << 25; // 32MB
            // Install the remembered set
            InstallRemSet();
        }
Example #13
0
        public static unsafe void Initialize()
        {
            maxEntries = 1 << 16;
            VTable UIntPtrArrayVtable =
                ((RuntimeType)typeof(UIntPtr[])).classVtable;

            tableSize =
                ObjectLayout.ArraySize(UIntPtrArrayVtable, maxEntries);

            // Allocate a pool for ZCT
            BumpAllocator entryPool = new BumpAllocator(PageType.NonGC);
            UIntPtr       memStart  = MemoryManager.AllocateMemory(tableSize);

            entryPool.SetZeroedRange(memStart, tableSize);
            PageManager.SetStaticDataPages(memStart, tableSize);

            // Initialize ZCT
            zeroCountTable = (UIntPtr[])
                             DeferredReferenceCountingCollector.
                             AllocateArray(ref entryPool,
                                           UIntPtrArrayVtable,
                                           tableSize);
            VTable.Assert(zeroCountTable != null,
                          @"zeroCountTable != null");

            *(uint *)(Magic.addressOf(zeroCountTable) + PostHeader.Size) =
                maxEntries;
            VTable.Assert(zeroCountTable.Length == maxEntries,
                          @"zeroCountTable.Length == maxEntries");

            // Build ZCT freeEntries list
            freeHead = 1;
            for (uint i = 1; i < maxEntries - 1; i++)
            {
                zeroCountTable[i] = (UIntPtr)(((i + 1) << 2) | 0x01);
            }
            zeroCountTable[maxEntries - 1] = (UIntPtr)0x01;

            zctGarbagePicker =
                (ZCTGarbagePicker)BootstrapMemory.
                Allocate(typeof(ZCTGarbagePicker));
        }
Example #14
0
        internal static void Initialize(UIntPtr os_commit_size,
                                        UIntPtr heap_commit_size)
        {
            PageManager.os_commit_size   = os_commit_size;
            PageManager.heap_commit_size = heap_commit_size;
            // unusedMemoryBlocks = new UnusedBlockHeader [32]
            unusedMemoryBlocks = (UnusedBlockHeader[])
                                 BootstrapMemory.Allocate(typeof(UnusedBlockHeader[]), 32);
            // outOfMemoryException = new OutOfMemoryException();
            outOfMemoryException = (OutOfMemoryException)
                                   BootstrapMemory.Allocate(typeof(OutOfMemoryException));
#if SINGULARITY_KERNEL
#if USE_SPINLOCK
            Lock = new SpinLock(SpinLock.Types.PageManager);
#endif
            avoidDirtyPages = true;
#else
            avoidDirtyPages = false;
#endif
        }
 public static new void Initialize()
 {
     GenerationalCollector.Initialize();
     // SlidingCollector.instance = new SlidingCollector();
     SlidingCollector.instance = (SlidingCollector)
                                 BootstrapMemory.Allocate(typeof(SlidingCollector));
     // markReferenceVisitor = new MarkReferenceVisitor();
     markReferenceVisitor = (MarkReferenceVisitor)
                            BootstrapMemory.Allocate(typeof(MarkReferenceVisitor));
     // registerThreadReferenceVisitor = new RegisterThreadReference();
     registerThreadReferenceVisitor = (RegisterThreadReference)
                                      BootstrapMemory.Allocate(typeof(RegisterThreadReference));
     // registerPinnedReferenceVisitor = new RegisterPinnedReference();
     registerPinnedReferenceVisitor = (RegisterPinnedReference)
                                      BootstrapMemory.Allocate(typeof(RegisterPinnedReference));
     // updateThreadReferenceVisitor = new UpdateThreadReference();
     updateThreadReferenceVisitor = (UpdateThreadReference)
                                    BootstrapMemory.Allocate(typeof(UpdateThreadReference));
     // forwardReferenceVisitor = new ForwardReferenceVisitor();
     forwardReferenceVisitor = (ForwardReferenceVisitor)
                               BootstrapMemory.Allocate(typeof(ForwardReferenceVisitor));
 }
 public static new void Initialize()
 {
     StopTheWorldCollector.Initialize();
     SegregatedFreeList.Initialize();
     // instance = new MarkSweepCollector();
     MarkSweepCollector.instance = (MarkSweepCollector)
                                   BootstrapMemory.Allocate(typeof(MarkSweepCollector));
     // markReferenceVisitor = new MarkReferenceVisitor();
     markReferenceVisitor = (MarkReferenceVisitor)
                            BootstrapMemory.Allocate(typeof(MarkReferenceVisitor));
     // markAndProcessReferenceVisitor = new MarkAndProcessReferenceVisitor();
     markAndProcessReferenceVisitor = (MarkAndProcessReferenceVisitor)
                                      BootstrapMemory.Allocate(typeof(MarkAndProcessReferenceVisitor));
     // updateReferenceVisitor = new UpdateReferenceVisitor();
     updateReferenceVisitor = (UpdateReferenceVisitor)
                              BootstrapMemory.Allocate(typeof(UpdateReferenceVisitor));
     // threadMarkReferenceVisitor = new ThreadMarkReferenceVisitor();
     threadMarkReferenceVisitor = (ThreadMarkReferenceVisitor)
                                  BootstrapMemory.Allocate(typeof(ThreadMarkReferenceVisitor));
     // sweepVisitor = new SweepVisitor();
     sweepVisitor = (SweepVisitor)
                    BootstrapMemory.Allocate(typeof(SweepVisitor));
     collectionTrigger = (UIntPtr)InitialTrigger;
 }
 internal static new void Initialize()
 {
     AllCardsWriteBarrier.instance = (AllCardsWriteBarrier)
                                     BootstrapMemory.Allocate(typeof(AllCardsWriteBarrier));
 }
Example #18
0
 internal static new void Initialize()
 {
     // preWriteFieldsVisitor = new PreWriteFieldsVisitor();
     LowAbortCoCoBarrier.preWriteFieldsVisitor = (PreWriteFieldsVisitor)
                                                 BootstrapMemory.Allocate(typeof(PreWriteFieldsVisitor));
 }
Example #19
0
 internal static new void Initialize()
 {
     BrooksBarrierTest.instance =
         (BrooksBarrierTest)
         BootstrapMemory.Allocate(typeof(BrooksBarrierTest));
 }
 internal static new void Initialize()
 {
     GenerationalWriteBarrier.instance = (GenerationalWriteBarrier)
                                         BootstrapMemory.Allocate(typeof(GenerationalWriteBarrier));
 }
 internal static new void Initialize()
 {
     CoCoBarrier.instance = AbortingCoCoBarrier.instance =
         (AbortingCoCoBarrier)
         BootstrapMemory.Allocate(typeof(AbortingCoCoBarrier));
 }