private void RunSingleCompilation(Dictionary <string, string> inFilePaths, InstructionSetSupport instructionSetSupport, string compositeRootPath, Dictionary <string, string> unrootedInputFilePaths, HashSet <ModuleDesc> versionBubbleModulesHash, CompilerTypeSystemContext typeSystemContext) { // // Initialize output filename // string inFilePath = inFilePaths.First().Value; string inputFileExtension = Path.GetExtension(inFilePath); string nearOutFilePath = inputFileExtension switch { ".dll" => Path.ChangeExtension(inFilePath, _commandLineOptions.SingleFileCompilation && _commandLineOptions.InputBubble ? ".ni.dll.tmp" : ".ni.dll"), ".exe" => Path.ChangeExtension(inFilePath, _commandLineOptions.SingleFileCompilation && _commandLineOptions.InputBubble ? ".ni.exe.tmp" : ".ni.exe"), _ => throw new CommandLineException(string.Format(SR.UnsupportedInputFileExtension, inputFileExtension)) }; string outFile = _commandLineOptions.OutNearInput ? nearOutFilePath : _commandLineOptions.OutputFilePath; using (PerfEventSource.StartStopEvents.CompilationEvents()) { ICompilation compilation; using (PerfEventSource.StartStopEvents.LoadingEvents()) { List <EcmaModule> inputModules = new List <EcmaModule>(); List <EcmaModule> rootingModules = new List <EcmaModule>(); foreach (var inputFile in inFilePaths) { EcmaModule module = typeSystemContext.GetModuleFromPath(inputFile.Value); inputModules.Add(module); rootingModules.Add(module); versionBubbleModulesHash.Add(module); if (!_commandLineOptions.CompositeOrInputBubble) { break; } } foreach (var unrootedInputFile in unrootedInputFilePaths) { EcmaModule module = typeSystemContext.GetModuleFromPath(unrootedInputFile.Value); inputModules.Add(module); versionBubbleModulesHash.Add(module); } // // Initialize compilation group and compilation roots // // Single method mode? MethodDesc singleMethod = CheckAndParseSingleMethodModeArguments(typeSystemContext); var logger = new Logger(Console.Out, _commandLineOptions.Verbose); List <string> mibcFiles = new List <string>(); foreach (var file in _commandLineOptions.MibcFilePaths) { mibcFiles.Add(file); } List <ModuleDesc> versionBubbleModules = new List <ModuleDesc>(versionBubbleModulesHash); if (!_commandLineOptions.Composite && inputModules.Count != 1) { throw new Exception(string.Format(SR.ErrorMultipleInputFilesCompositeModeOnly, string.Join("; ", inputModules))); } ReadyToRunCompilationModuleGroupBase compilationGroup; List <ICompilationRootProvider> compilationRoots = new List <ICompilationRootProvider>(); if (singleMethod != null) { // Compiling just a single method compilationGroup = new SingleMethodCompilationModuleGroup( typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics, singleMethod); compilationRoots.Add(new SingleMethodRootProvider(singleMethod)); } else if (_commandLineOptions.CompileNoMethods) { compilationGroup = new NoMethodsCompilationModuleGroup( typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics); } else { // Single assembly compilation. compilationGroup = new ReadyToRunSingleAssemblyCompilationModuleGroup( typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics); } // Load any profiles generated by method call chain analyis CallChainProfile jsonProfile = null; if (!string.IsNullOrEmpty(_commandLineOptions.CallChainProfileFile)) { jsonProfile = new CallChainProfile(_commandLineOptions.CallChainProfileFile, typeSystemContext, _referenceableModules); } // Examine profile guided information as appropriate ProfileDataManager profileDataManager = new ProfileDataManager(logger, _referenceableModules, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics ? inputModules[0] : null, mibcFiles, jsonProfile, typeSystemContext, compilationGroup, _commandLineOptions.EmbedPgoData); if (_commandLineOptions.Partial) { compilationGroup.ApplyProfilerGuidedCompilationRestriction(profileDataManager); } else { compilationGroup.ApplyProfilerGuidedCompilationRestriction(null); } if ((singleMethod == null) && !_commandLineOptions.CompileNoMethods) { // For normal compilations add compilation roots. foreach (var module in rootingModules) { compilationRoots.Add(new ReadyToRunRootProvider( module, profileDataManager, profileDrivenPartialNGen: _commandLineOptions.Partial)); if (!_commandLineOptions.CompositeOrInputBubble) { break; } } } // In single-file compilation mode, use the assembly's DebuggableAttribute to determine whether to optimize // or produce debuggable code if an explicit optimization level was not specified on the command line OptimizationMode optimizationMode = _optimizationMode; if (optimizationMode == OptimizationMode.None && !_commandLineOptions.OptimizeDisabled && !_commandLineOptions.Composite) { System.Diagnostics.Debug.Assert(inputModules.Count == 1); optimizationMode = ((EcmaAssembly)inputModules[0].Assembly).HasOptimizationsDisabled() ? OptimizationMode.None : OptimizationMode.Blended; } CompositeImageSettings compositeImageSettings = new CompositeImageSettings(); if (_commandLineOptions.CompositeKeyFile != null) { ImmutableArray <byte> compositeStrongNameKey = File.ReadAllBytes(_commandLineOptions.CompositeKeyFile).ToImmutableArray(); if (!IsValidPublicKey(compositeStrongNameKey)) { throw new Exception(string.Format(SR.ErrorCompositeKeyFileNotPublicKey)); } compositeImageSettings.PublicKey = compositeStrongNameKey; } // // Compile // ReadyToRunCodegenCompilationBuilder builder = new ReadyToRunCodegenCompilationBuilder( typeSystemContext, compilationGroup, _allInputFilePaths.Values, compositeRootPath); string compilationUnitPrefix = ""; builder.UseCompilationUnitPrefix(compilationUnitPrefix); ILProvider ilProvider = new ReadyToRunILProvider(); DependencyTrackingLevel trackingLevel = _commandLineOptions.DgmlLogFileName == null ? DependencyTrackingLevel.None : (_commandLineOptions.GenerateFullDgmlLog ? DependencyTrackingLevel.All : DependencyTrackingLevel.First); builder .UseIbcTuning(_commandLineOptions.Tuning) .UseResilience(_commandLineOptions.Resilient) .UseMapFile(_commandLineOptions.Map) .UseMapCsvFile(_commandLineOptions.MapCsv) .UsePdbFile(_commandLineOptions.Pdb, _commandLineOptions.PdbPath) .UsePerfMapFile(_commandLineOptions.PerfMap, _commandLineOptions.PerfMapPath, _commandLineOptions.PerfMapFormatVersion) .UseProfileFile(jsonProfile != null) .UseParallelism(_commandLineOptions.Parallelism) .UseProfileData(profileDataManager) .FileLayoutAlgorithms(_methodLayout, _fileLayout) .UseCompositeImageSettings(compositeImageSettings) .UseJitPath(_commandLineOptions.JitPath) .UseInstructionSetSupport(instructionSetSupport) .UseCustomPESectionAlignment(_commandLineOptions.CustomPESectionAlignment) .UseVerifyTypeAndFieldLayout(_commandLineOptions.VerifyTypeAndFieldLayout) .GenerateOutputFile(outFile) .UseILProvider(ilProvider) .UseBackendOptions(_commandLineOptions.CodegenOptions) .UseLogger(logger) .UseDependencyTracking(trackingLevel) .UseCompilationRoots(compilationRoots) .UseOptimizationMode(optimizationMode); if (_commandLineOptions.PrintReproInstructions) { builder.UsePrintReproInstructions(CreateReproArgumentString); } compilation = builder.ToCompilation(); } compilation.Compile(outFile); if (_commandLineOptions.DgmlLogFileName != null) { compilation.WriteDependencyLog(_commandLineOptions.DgmlLogFileName); } compilation.Dispose(); } }
private int Run(string[] args) { using (PerfEventSource.StartStopEvents.CompilationEvents()) { ICompilation compilation; using (PerfEventSource.StartStopEvents.LoadingEvents()) { InitializeDefaultOptions(); ProcessCommandLine(args); if (_commandLineOptions.Help) { Console.WriteLine(_commandLineOptions.HelpText); return(1); } if (_commandLineOptions.OutputFilePath == null) { throw new CommandLineException(SR.MissingOutputFile); } ConfigureTarget(); InstructionSetSupport instructionSetSupport = ConfigureInstructionSetSupport(); // // Initialize type system context // SharedGenericsMode genericsMode = SharedGenericsMode.CanonicalReferenceTypes; var targetDetails = new TargetDetails(_targetArchitecture, _targetOS, TargetAbi.CoreRT, instructionSetSupport.GetVectorTSimdVector()); bool versionBubbleIncludesCoreLib = false; if (_commandLineOptions.InputBubble) { versionBubbleIncludesCoreLib = true; } else { foreach (var inputFile in _inputFilePaths) { if (String.Compare(inputFile.Key, "System.Private.CoreLib", StringComparison.OrdinalIgnoreCase) == 0) { versionBubbleIncludesCoreLib = true; break; } } if (!versionBubbleIncludesCoreLib) { foreach (var inputFile in _unrootedInputFilePaths) { if (String.Compare(inputFile.Key, "System.Private.CoreLib", StringComparison.OrdinalIgnoreCase) == 0) { versionBubbleIncludesCoreLib = true; break; } } } } _typeSystemContext = new ReadyToRunCompilerContext(targetDetails, genericsMode, versionBubbleIncludesCoreLib); string compositeRootPath = _commandLineOptions.CompositeRootPath; // // TODO: To support our pre-compiled test tree, allow input files that aren't managed assemblies since // some tests contain a mixture of both managed and native binaries. // // See: https://github.com/dotnet/corert/issues/2785 // // When we undo this this hack, replace this foreach with // typeSystemContext.InputFilePaths = _inputFilePaths; // Dictionary <string, string> allInputFilePaths = new Dictionary <string, string>(); Dictionary <string, string> inputFilePaths = new Dictionary <string, string>(); List <ModuleDesc> referenceableModules = new List <ModuleDesc>(); foreach (var inputFile in _inputFilePaths) { try { var module = _typeSystemContext.GetModuleFromPath(inputFile.Value); allInputFilePaths.Add(inputFile.Key, inputFile.Value); inputFilePaths.Add(inputFile.Key, inputFile.Value); referenceableModules.Add(module); if (compositeRootPath == null) { compositeRootPath = Path.GetDirectoryName(inputFile.Value); } } catch (TypeSystemException.BadImageFormatException) { // Keep calm and carry on. } } Dictionary <string, string> unrootedInputFilePaths = new Dictionary <string, string>(); foreach (var unrootedInputFile in _unrootedInputFilePaths) { try { var module = _typeSystemContext.GetModuleFromPath(unrootedInputFile.Value); if (!allInputFilePaths.ContainsKey(unrootedInputFile.Key)) { allInputFilePaths.Add(unrootedInputFile.Key, unrootedInputFile.Value); unrootedInputFilePaths.Add(unrootedInputFile.Key, unrootedInputFile.Value); referenceableModules.Add(module); if (compositeRootPath == null) { compositeRootPath = Path.GetDirectoryName(unrootedInputFile.Value); } } } catch (TypeSystemException.BadImageFormatException) { // Keep calm and carry on. } } CheckManagedCppInputFiles(allInputFilePaths.Values); _typeSystemContext.InputFilePaths = allInputFilePaths; _typeSystemContext.ReferenceFilePaths = _referenceFilePaths; List <EcmaModule> inputModules = new List <EcmaModule>(); List <EcmaModule> rootingModules = new List <EcmaModule>(); HashSet <ModuleDesc> versionBubbleModulesHash = new HashSet <ModuleDesc>(); foreach (var inputFile in inputFilePaths) { EcmaModule module = _typeSystemContext.GetModuleFromPath(inputFile.Value); inputModules.Add(module); rootingModules.Add(module); versionBubbleModulesHash.Add(module); if (!_commandLineOptions.CompositeOrInputBubble) { break; } } foreach (var unrootedInputFile in unrootedInputFilePaths) { EcmaModule module = _typeSystemContext.GetModuleFromPath(unrootedInputFile.Value); inputModules.Add(module); versionBubbleModulesHash.Add(module); } string systemModuleName = _commandLineOptions.SystemModule ?? DefaultSystemModule; _typeSystemContext.SetSystemModule((EcmaModule)_typeSystemContext.GetModuleForSimpleName(systemModuleName)); if (_typeSystemContext.InputFilePaths.Count == 0) { if (_commandLineOptions.InputFilePaths.Count > 0) { Console.WriteLine(SR.InputWasNotLoadable); return(2); } throw new CommandLineException(SR.NoInputFiles); } // // Initialize compilation group and compilation roots // // Single method mode? MethodDesc singleMethod = CheckAndParseSingleMethodModeArguments(_typeSystemContext); var logger = new Logger(Console.Out, _commandLineOptions.Verbose); List <string> mibcFiles = new List <string>(); foreach (var file in _commandLineOptions.MibcFilePaths) { mibcFiles.Add(file); } foreach (var referenceFile in _referenceFilePaths.Values) { try { EcmaModule module = _typeSystemContext.GetModuleFromPath(referenceFile); if (versionBubbleModulesHash.Contains(module)) { // Ignore reference assemblies that have also been passed as inputs continue; } referenceableModules.Add(module); if (_commandLineOptions.InputBubble) { // In large version bubble mode add reference paths to the compilation group versionBubbleModulesHash.Add(module); } } catch { } // Ignore non-managed pe files } List <ModuleDesc> versionBubbleModules = new List <ModuleDesc>(versionBubbleModulesHash); if (!_commandLineOptions.Composite && inputModules.Count != 1) { throw new Exception(string.Format(SR.ErrorMultipleInputFilesCompositeModeOnly, string.Join("; ", inputModules))); } ReadyToRunCompilationModuleGroupBase compilationGroup; List <ICompilationRootProvider> compilationRoots = new List <ICompilationRootProvider>(); if (singleMethod != null) { // Compiling just a single method compilationGroup = new SingleMethodCompilationModuleGroup( _typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics, singleMethod); compilationRoots.Add(new SingleMethodRootProvider(singleMethod)); } else if (_commandLineOptions.CompileNoMethods) { compilationGroup = new NoMethodsCompilationModuleGroup( _typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics); } else { // Single assembly compilation. compilationGroup = new ReadyToRunSingleAssemblyCompilationModuleGroup( _typeSystemContext, _commandLineOptions.Composite, _commandLineOptions.InputBubble, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics); } // Load any profiles generated by method call chain analyis CallChainProfile jsonProfile = null; if (!string.IsNullOrEmpty(_commandLineOptions.CallChainProfileFile)) { jsonProfile = new CallChainProfile(_commandLineOptions.CallChainProfileFile, _typeSystemContext, referenceableModules); } // Examine profile guided information as appropriate ProfileDataManager profileDataManager = new ProfileDataManager(logger, referenceableModules, inputModules, versionBubbleModules, _commandLineOptions.CompileBubbleGenerics ? inputModules[0] : null, mibcFiles, jsonProfile, _typeSystemContext, compilationGroup, _commandLineOptions.EmbedPgoData); if (_commandLineOptions.Partial) { compilationGroup.ApplyProfilerGuidedCompilationRestriction(profileDataManager); } else { compilationGroup.ApplyProfilerGuidedCompilationRestriction(null); } if ((singleMethod == null) && !_commandLineOptions.CompileNoMethods) { // For normal compilations add compilation roots. foreach (var module in rootingModules) { compilationRoots.Add(new ReadyToRunRootProvider( module, profileDataManager, profileDrivenPartialNGen: _commandLineOptions.Partial)); if (!_commandLineOptions.CompositeOrInputBubble) { break; } } } // In single-file compilation mode, use the assembly's DebuggableAttribute to determine whether to optimize // or produce debuggable code if an explicit optimization level was not specified on the command line if (_optimizationMode == OptimizationMode.None && !_commandLineOptions.OptimizeDisabled && !_commandLineOptions.Composite) { System.Diagnostics.Debug.Assert(inputModules.Count == 1); _optimizationMode = ((EcmaAssembly)inputModules[0].Assembly).HasOptimizationsDisabled() ? OptimizationMode.None : OptimizationMode.Blended; } // // Compile // ReadyToRunCodegenCompilationBuilder builder = new ReadyToRunCodegenCompilationBuilder( _typeSystemContext, compilationGroup, allInputFilePaths.Values, compositeRootPath); string compilationUnitPrefix = ""; builder.UseCompilationUnitPrefix(compilationUnitPrefix); ILProvider ilProvider = new ReadyToRunILProvider(); DependencyTrackingLevel trackingLevel = _commandLineOptions.DgmlLogFileName == null ? DependencyTrackingLevel.None : (_commandLineOptions.GenerateFullDgmlLog ? DependencyTrackingLevel.All : DependencyTrackingLevel.First); builder .UseIbcTuning(_commandLineOptions.Tuning) .UseResilience(_commandLineOptions.Resilient) .UseMapFile(_commandLineOptions.Map) .UseMapCsvFile(_commandLineOptions.MapCsv) .UsePdbFile(_commandLineOptions.Pdb, _commandLineOptions.PdbPath) .UsePerfMapFile(_commandLineOptions.PerfMap, _commandLineOptions.PerfMapPath) .UseProfileFile(jsonProfile != null) .UseParallelism(_commandLineOptions.Parallelism) .UseProfileData(profileDataManager) .FileLayoutAlgorithms(_methodLayout, _fileLayout) .UseJitPath(_commandLineOptions.JitPath) .UseInstructionSetSupport(instructionSetSupport) .UseCustomPESectionAlignment(_commandLineOptions.CustomPESectionAlignment) .UseVerifyTypeAndFieldLayout(_commandLineOptions.VerifyTypeAndFieldLayout) .GenerateOutputFile(_commandLineOptions.OutputFilePath) .UseILProvider(ilProvider) .UseBackendOptions(_commandLineOptions.CodegenOptions) .UseLogger(logger) .UseDependencyTracking(trackingLevel) .UseCompilationRoots(compilationRoots) .UseOptimizationMode(_optimizationMode); if (_commandLineOptions.PrintReproInstructions) { builder.UsePrintReproInstructions(CreateReproArgumentString); } compilation = builder.ToCompilation(); } compilation.Compile(_commandLineOptions.OutputFilePath); if (_commandLineOptions.DgmlLogFileName != null) { compilation.WriteDependencyLog(_commandLineOptions.DgmlLogFileName); } } return(0); }
public ProfileDataManager(Logger logger, IEnumerable <ModuleDesc> possibleReferenceModules, IEnumerable <ModuleDesc> inputModules, IEnumerable <ModuleDesc> versionBubbleModules, ModuleDesc nonLocalGenericsHome, IReadOnlyList <string> mibcFiles, CallChainProfile callChainProfile, CompilerTypeSystemContext context, ReadyToRunCompilationModuleGroupBase compilationGroup) { _ibcParser = new IBCProfileParser(logger, possibleReferenceModules); _compilationGroup = compilationGroup; _callChainProfile = callChainProfile; HashSet <ModuleDesc> versionBubble = new HashSet <ModuleDesc>(versionBubbleModules); { // Parse MIbc Data string onlyParseItemsDefinedInAssembly = nonLocalGenericsHome == null?inputModules.First().Assembly.GetName().Name : null; HashSet <string> versionBubbleModuleStrings = new HashSet <string>(); foreach (ModuleDesc versionBubbleModule in versionBubble) { versionBubbleModuleStrings.Add(versionBubbleModule.Assembly.GetName().Name); } foreach (string file in mibcFiles) { _inputData.Add(MIbcProfileParser.ParseMIbcFile(context, file, versionBubbleModuleStrings, onlyParseItemsDefinedInAssembly)); } } { // Parse Ibc data foreach (var module in inputModules) { _inputData.Add(_ibcParser.ParseIBCDataFromModule((EcmaModule)module)); _placedProfileMethods.Add(module, new HashSet <MethodDesc>()); } } // Merge all data together foreach (ProfileData profileData in _inputData) { MergeProfileData(ref _partialNGen, _mergedProfileData, profileData); } // With the merged data find the set of methods to be placed within this module foreach (var profileData in _mergedProfileData) { // If the method is not excluded from processing if (!profileData.Value.Flags.HasFlag(MethodProfilingDataFlags.ExcludeHotMethodCode) && !profileData.Value.Flags.HasFlag(MethodProfilingDataFlags.ExcludeColdMethodCode)) { // Check for methods which are defined within the version bubble, and only rely on other modules within the bubble if (!_compilationGroup.VersionsWithMethodBody(profileData.Key)) { continue; // Method not contained within version bubble } if (_compilationGroup.ContainsType(profileData.Key.OwningType) && (profileData.Key.OwningType is MetadataType declaringType)) { // In this case the method is placed in its natural home (which is the defining module of the method) _placedProfileMethods[declaringType.Module].Add(profileData.Key); _placedProfileMethodsAll.Add(profileData.Key); } else { // If the defining module is not within the input set, if the nonLocalGenericsHome is provided, place it there if ((nonLocalGenericsHome != null) && (profileData.Key.GetTypicalMethodDefinition() != profileData.Key)) { _placedProfileMethods[nonLocalGenericsHome].Add(profileData.Key); _placedProfileMethodsAll.Add(profileData.Key); } } } } }
public ProfileDataManager(Logger logger, IEnumerable <ModuleDesc> possibleReferenceModules, IEnumerable <ModuleDesc> inputModules, IEnumerable <ModuleDesc> versionBubbleModules, IEnumerable <ModuleDesc> crossModuleInlineModules, ModuleDesc nonLocalGenericsHome, IReadOnlyList <string> mibcFiles, MIbcProfileParser.MibcGroupParseRules parseRule, CallChainProfile callChainProfile, CompilerTypeSystemContext context, ReadyToRunCompilationModuleGroupBase compilationGroup, bool embedPgoDataInR2RImage, bool parseIbcData, Func <MethodDesc, bool> canBeIncludedInCurrentCompilation) { EmbedPgoDataInR2RImage = embedPgoDataInR2RImage; _ibcParser = new IBCProfileParser(logger, possibleReferenceModules); _compilationGroup = compilationGroup; _callChainProfile = callChainProfile; HashSet <ModuleDesc> versionBubble = new HashSet <ModuleDesc>(versionBubbleModules); { // Parse MIbc Data string onlyParseItemsDefinedInAssembly = null; if (nonLocalGenericsHome == null && !compilationGroup.IsCompositeBuildMode) { onlyParseItemsDefinedInAssembly = inputModules.First().Assembly.GetName().Name; } HashSet <string> versionBubbleModuleStrings = new HashSet <string>(); foreach (ModuleDesc versionBubbleModule in versionBubble) { versionBubbleModuleStrings.Add(versionBubbleModule.Assembly.GetName().Name); } HashSet <string> crossModuleStrings = new HashSet <string>(); foreach (ModuleDesc crossModule in crossModuleInlineModules) { crossModuleStrings.Add(crossModule.Assembly.GetName().Name); } foreach (string file in mibcFiles) { using (PEReader peReader = MIbcProfileParser.OpenMibcAsPEReader(file)) { _inputData.Add(MIbcProfileParser.ParseMIbcFile(context, peReader, versionBubbleModuleStrings, onlyParseItemsDefinedInAssembly, crossModuleInlineModules: crossModuleStrings, parseRule: parseRule)); } } } if (parseIbcData) { // Parse Ibc data foreach (var module in inputModules) { _inputData.Add(_ibcParser.ParseIBCDataFromModule((EcmaModule)module)); } } // Ensure each module has a hashset of methods available foreach (var module in inputModules) { _placedProfileMethods.Add(module, new HashSet <MethodDesc>()); } // Merge all data together foreach (ProfileData profileData in _inputData) { ProfileData.MergeProfileData(ref _partialNGen, _mergedProfileData, profileData); } // With the merged data find the set of methods to be placed within this module foreach (var profileData in _mergedProfileData) { // If the method is not excluded from processing if (!profileData.Value.Flags.HasFlag(MethodProfilingDataFlags.ExcludeHotMethodCode) && !profileData.Value.Flags.HasFlag(MethodProfilingDataFlags.ExcludeColdMethodCode)) { // Check for methods which are defined within the version bubble, and only rely on other modules within the bubble if (!_compilationGroup.VersionsWithMethodBody(profileData.Key) && !_compilationGroup.CrossModuleCompileable(profileData.Key)) { continue; // Method not contained within version bubble and not cross module compileable } if (_compilationGroup.ContainsType(profileData.Key.OwningType) && (profileData.Key.OwningType is MetadataType declaringType)) { // In this case the method is placed in its natural home (which is the defining module of the method) _placedProfileMethods[declaringType.Module].Add(profileData.Key); _placedProfileMethodsAll.Add(profileData.Key); } else { // If the defining module is not within the input set, if the nonLocalGenericsHome is provided, place it there if ((nonLocalGenericsHome != null) && (profileData.Key.GetTypicalMethodDefinition() != profileData.Key)) { _placedProfileMethods[nonLocalGenericsHome].Add(profileData.Key); _placedProfileMethodsAll.Add(profileData.Key); } } } } }