private static void Add(McgModule module) { if (s_moduleCount >= MAX_MODULES) { Environment.FailFast("Limit of modules reached"); //Can`t be localized, eager cctor dependency error. } // workaround for multifile cctor ordering issue: init s_modules lazily if (s_modules == null) { s_modules = new McgModule[MAX_MODULES]; s_modules[s_moduleCount++] = module; return; } // insert module into s_modules with correct order // make sure modules with larger priority values are listed first int index = s_moduleCount - 1; for (; index >= 0; index--) { if (s_modules[index].ModulePriority < module.ModulePriority) { s_modules[index + 1] = s_modules[index]; } else { break; } } s_modules[index + 1] = module; // Increment the count after we make the assignment to avoid off-by-1 mistakes s_moduleCount++; }
public CCWTemplateInfo(McgModule mcgModule, int ccwTemplateDataIndex) { m_ModuleIndex = McgModuleManager.GetModuleIndex(mcgModule); m_Index = ccwTemplateDataIndex; #if DEBUG m_CCWTemplateData_DebugOnly = mcgModule.CCWTemplateData[m_Index]; #endif }
/// <summary> /// Constructor /// </summary> public McgTypeInfo(int index, McgModule mcgModule) { m_TypeIndex = index; m_ModuleIndex = McgModuleManager.GetModuleIndex(mcgModule); #if DEBUG m_InterfaceData_DebugOnly = mcgModule.GetInterfaceDataByIndex(m_TypeIndex); #endif }
/// <summary> /// Register the module and add it into global module list /// This should always be called from eagerly constructed ctors so threading is not a concern /// </summary> public static void Register(McgModule module) { // This API is called by .cctors, so we don't need to support multi-threaded callers. if (s_internalModule == null) { s_internalModule = new InternalModule(); Add(s_internalModule); } Add(module); }
public ClassFactory(McgModule parent, RuntimeTypeHandle classType) { this.parent = parent; this.classType = classType; }