示例#1
0
 public static new void Initialize()
 {
     GenerationalCollector.Initialize();
     SemispaceCollector.Initialize();
     SlidingCollector.Initialize();
     // instance = new AdaptiveCopyingCollector();
     instance = (AdaptiveCopyingCollector )
                BootstrapMemory.Allocate(typeof(AdaptiveCopyingCollector));
 }
        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));
        }