protected sealed override unsafe object GetFieldBypassCctor() { if (FieldBase == FieldTableFlags.GCStatic) { object gcStaticsRegion = RuntimeAugments.LoadReferenceTypeField(StaticsBase); return RuntimeAugments.LoadValueTypeField(gcStaticsRegion, FieldOffset, FieldTypeHandle); } else if (FieldBase == FieldTableFlags.NonGCStatic) { return RuntimeAugments.LoadValueTypeField(StaticsBase + FieldOffset, FieldTypeHandle); } Debug.Assert(FieldBase == FieldTableFlags.ThreadStatic); object threadStaticRegion = RuntimeAugments.GetThreadStaticBase(StaticsBase); return RuntimeAugments.LoadValueTypeField(threadStaticRegion, FieldOffset, FieldTypeHandle); }
protected sealed override unsafe void UncheckedSetFieldBypassCctor(object value) { if (FieldBase == FieldTableFlags.GCStatic) { object gcStaticsRegion = RuntimeAugments.LoadReferenceTypeField(StaticsBase); RuntimeAugments.StoreValueTypeField(gcStaticsRegion, FieldOffset, value, typeof(IntPtr).TypeHandle); } else if (FieldBase == FieldTableFlags.NonGCStatic) { RuntimeAugments.StoreValueTypeField(StaticsBase + FieldOffset, value, typeof(IntPtr).TypeHandle); } else { Debug.Assert(FieldBase == FieldTableFlags.ThreadStatic); object threadStaticsRegion = RuntimeAugments.GetThreadStaticBase(StaticsBase); RuntimeAugments.StoreValueTypeField(threadStaticsRegion, FieldOffset, value, typeof(IntPtr).TypeHandle); } }
unsafe protected sealed override Object GetFieldBypassCctor() { if (FieldBase == FieldTableFlags.GCStatic) { // The _staticsBase variable points to a GC handle, which points at the GC statics base of the type. // We need to perform a double indirection in a GC-safe manner. object gcStaticsRegion = RuntimeAugments.LoadReferenceTypeField(*(IntPtr *)StaticsBase); return(RuntimeAugments.LoadReferenceTypeField(gcStaticsRegion, FieldOffset)); } else if (FieldBase == FieldTableFlags.NonGCStatic) { return(RuntimeAugments.LoadReferenceTypeField(StaticsBase + FieldOffset)); } Debug.Assert(FieldBase == FieldTableFlags.ThreadStatic); object threadStaticRegion = RuntimeAugments.GetThreadStaticBase(StaticsBase); return(RuntimeAugments.LoadReferenceTypeField(threadStaticRegion, FieldOffset)); }
unsafe protected sealed override void UncheckedSetFieldBypassCctor(Object value) { if (FieldBase == FieldTableFlags.GCStatic) { // The _staticsBase variable points to a GC handle, which points at the GC statics base of the type. // We need to perform a double indirection in a GC-safe manner. object gcStaticsRegion = RuntimeAugments.LoadReferenceTypeField(*(IntPtr *)StaticsBase); RuntimeAugments.StoreValueTypeField(gcStaticsRegion, FieldOffset, value, typeof(IntPtr).TypeHandle); } else if (FieldBase == FieldTableFlags.NonGCStatic) { RuntimeAugments.StoreValueTypeField(StaticsBase + FieldOffset, value, typeof(IntPtr).TypeHandle); } else { Debug.Assert(FieldBase == FieldTableFlags.ThreadStatic); object threadStaticsRegion = RuntimeAugments.GetThreadStaticBase(StaticsBase); RuntimeAugments.StoreValueTypeField(threadStaticsRegion, FieldOffset, value, typeof(IntPtr).TypeHandle); } }