Beispiel #1
0
        static GC() // Class Constructor (cctor)
        {
            GC.Initialize();
            switch (gcType)
            {
#if !SINGULARITY || ADAPTIVE_COPYING_COLLECTOR
            case GCType.AdaptiveCopyingCollector: {
                AdaptiveCopyingCollector.Initialize();
                GC.installedGC = AdaptiveCopyingCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || MARK_SWEEP_COLLECTOR
            case GCType.MarkSweepCollector: {
                MarkSweepCollector.Initialize();
                GC.installedGC = MarkSweepCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || TABLE_MARK_SWEEP_COLLECTOR
            case GCType.TableMarkSweepCollector: {
                SimpleMarkSweepCollector.Initialize();
                GC.installedGC = SimpleMarkSweepCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || SEMISPACE_COLLECTOR
            case GCType.SemispaceCollector: {
                SemispaceCollector.Initialize();
                GC.installedGC = SemispaceCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || SLIDING_COLLECTOR
            case GCType.SlidingCollector: {
                SlidingCollector.Initialize();
                GC.installedGC = SlidingCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || CONCURRENT_MS_COLLECTOR
            case GCType.ConcurrentMSCollector: {
                ConcurrentMSCollector.Initialize();
                GC.installedGC = ConcurrentMSCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || ATOMIC_RC_COLLECTOR
            case GCType.AtomicRCCollector: {
                AtomicRCCollector.Initialize();
                GC.installedGC = AtomicRCCollector.instance;
                break;
            }
#endif
#if !SINGULARITY
            case GCType.ReferenceCountingCollector: {
                ReferenceCountingCollector.Initialize();
                GC.installedGC = ReferenceCountingCollector.instance;
                break;
            }
#endif
#if !SINGULARITY
            case GCType.DeferredReferenceCountingCollector: {
                DeferredReferenceCountingCollector.Initialize();
                GC.installedGC = DeferredReferenceCountingCollector.instance;
                break;
            }
#endif
#if !SINGULARITY || NULL_COLLECTOR
            case GCType.NullCollector: {
                VTable.Assert(wbType == 0, "No need for a write barrier");
                GC.installedGC =
                    (NullCollector)
                    BootstrapMemory.Allocate(typeof(NullCollector));
                break;
            }
#endif
#if !SINGULARITY
            case GCType.CoCoMSCollector: {
                CoCoMSCollector.Initialize();
                GC.installedGC = CoCoMSCollector.instance;
                break;
            }
#endif
            default: {
                VTable.NotReached("Unknown GC type: " + gcType);
                break;
            }
            }
            GC.installedGC.NewThreadNotification(Thread.initialThread, true);
            GC.installedGC.ThreadStartNotification(Thread.initialThread.threadIndex);
        }