/// <summary> /// Get a pointer to a pointer to the gc static field data of a type. This function works for all generic types /// </summary> public IntPtr TryGetGcStaticFieldData(RuntimeTypeHandle runtimeTypeHandle) { unsafe { // Non-generic, non-dynamic static data is found via the FieldAccessMap EEType *typeAsEEType = runtimeTypeHandle.ToEETypePtr(); // Non-generic, non-dynamic types need special handling. Debug.Assert(typeAsEEType->IsDynamicType || typeAsEEType->IsGeneric); } // Search hashtable for static entry ExternalReferencesTable staticInfoLookup; var parser = GetStaticInfo(runtimeTypeHandle, out staticInfoLookup); if (!parser.IsNull) { var index = parser.GetUnsignedForBagElementKind(BagElementKind.GcStaticData); return(index.HasValue ? staticInfoLookup.GetIntPtrFromIndex(index.Value) : IntPtr.Zero); } // Not found in hashtable... must be a dynamically created type Debug.Assert(runtimeTypeHandle.IsDynamicType()); return(RuntimeAugments.GetGcStaticFieldData(runtimeTypeHandle)); }