Exemple #1
0
        public override TypeCode GetTypeCode()
        {
            StructuralType type = this.vtable.structuralView;

            switch (type)
            {
            case StructuralType.Int8:
                return(TypeCode.SByte);

            case StructuralType.Int16:
                return(TypeCode.Int16);

            case StructuralType.Int32:
                return(TypeCode.Int32);

            case StructuralType.Int64:
                return(TypeCode.Int64);

            case StructuralType.UInt8:
                return(TypeCode.Byte);

            case StructuralType.UInt16:
                return(TypeCode.UInt16);

            case StructuralType.UInt32:
                return(TypeCode.UInt32);

            case StructuralType.UInt64:
                return(TypeCode.UInt64);

            default:
                VTable.NotReached("bad enum in InternalGetValue");
                return(TypeCode.Object);
            }
        }
Exemple #2
0
        private Object GetValue()
        {
            StructuralType type = this.vtable.structuralView;
            Object         result;

            switch (type)
            {
            case StructuralType.Int8:
                result = (sbyte)(Object)this;
                break;

            case StructuralType.Int16:
                result = (short)(Object)this;
                break;

            case StructuralType.Int32:
                result = (int)(Object)this;
                break;

            case StructuralType.Int64:
                result = (long)(Object)this;
                break;

            case StructuralType.UInt8:
                result = (byte)(Object)this;
                break;

            case StructuralType.UInt16:
                result = (ushort)(Object)this;
                break;

            case StructuralType.UInt32:
                result = (uint)(Object)this;
                break;

            case StructuralType.UInt64:
                result = (ulong)(Object)this;
                break;

            default:
                VTable.NotReached("bad enum in InternalGetValue");
                result = null;
                break;
            }
            return(result);
        }
 internal RuntimeType()
 {
     VTable.NotReached("RuntimeType constructor not supported");
 }
Exemple #4
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);
        }