// get the statics hash table, external references, and static info table for a module // TODO multi-file: consider whether we want to cache this info private unsafe bool GetStaticsInfoHashtable(NativeFormatModuleInfo module, out NativeHashtable staticsInfoHashtable, out ExternalReferencesTable externalReferencesLookup, out ExternalReferencesTable staticInfoLookup) { byte *pBlob; uint cbBlob; staticsInfoHashtable = default(NativeHashtable); externalReferencesLookup = default(ExternalReferencesTable); staticInfoLookup = default(ExternalReferencesTable); // Load statics info hashtable if (!module.TryFindBlob(ReflectionMapBlob.StaticsInfoHashtable, out pBlob, out cbBlob)) { return(false); } NativeReader reader = new NativeReader(pBlob, cbBlob); NativeParser parser = new NativeParser(reader, 0); if (!externalReferencesLookup.InitializeNativeReferences(module)) { return(false); } if (!staticInfoLookup.InitializeNativeStatics(module)) { return(false); } staticsInfoHashtable = new NativeHashtable(parser); return(true); }
// get the statics hash table, external references, and static info table for a module // TODO multi-file: consider whether we want to cache this info private unsafe bool GetStaticsInfoHashtable(IntPtr moduleHandle, out NativeHashtable staticsInfoHashtable, out ExternalReferencesTable externalReferencesLookup, out ExternalReferencesTable staticInfoLookup) { byte *pBlob; uint cbBlob; staticsInfoHashtable = default(NativeHashtable); externalReferencesLookup = default(ExternalReferencesTable); staticInfoLookup = default(ExternalReferencesTable); // Load statics info hashtable if (!RuntimeAugments.FindBlob(moduleHandle, (int)ReflectionMapBlob.StaticsInfoHashtable, new IntPtr(&pBlob), new IntPtr(&cbBlob))) { return(false); } NativeReader reader = new NativeReader(pBlob, cbBlob); NativeParser parser = new NativeParser(reader, 0); if (!externalReferencesLookup.InitializeNativeReferences(moduleHandle)) { return(false); } if (!staticInfoLookup.InitializeNativeStatics(moduleHandle)) { return(false); } staticsInfoHashtable = new NativeHashtable(parser); return(true); }
internal IntPtr GetGCStaticInfo(uint index) { if (!_staticInfoLookup.IsInitialized()) { bool success = _staticInfoLookup.InitializeNativeStatics(_module); Debug.Assert(success); } return(_staticInfoLookup.GetIntPtrFromIndex(index)); }
// get the statics hash table, external references, and static info table for a module // TODO multi-file: consider whether we want to cache this info private unsafe bool GetStaticsInfoHashtable(IntPtr moduleHandle, out NativeHashtable staticsInfoHashtable, out ExternalReferencesTable externalReferencesLookup, out ExternalReferencesTable staticInfoLookup) { byte* pBlob; uint cbBlob; staticsInfoHashtable = default(NativeHashtable); externalReferencesLookup = default(ExternalReferencesTable); staticInfoLookup = default(ExternalReferencesTable); // Load statics info hashtable if (!RuntimeAugments.FindBlob(moduleHandle, (int)ReflectionMapBlob.StaticsInfoHashtable, new IntPtr(&pBlob), new IntPtr(&cbBlob))) return false; NativeReader reader = new NativeReader(pBlob, cbBlob); NativeParser parser = new NativeParser(reader, 0); if (!externalReferencesLookup.InitializeNativeReferences(moduleHandle)) return false; if (!staticInfoLookup.InitializeNativeStatics(moduleHandle)) return false; staticsInfoHashtable = new NativeHashtable(parser); return true; }