internal ReadyToRunCodegenCompilation( DependencyAnalyzerBase <NodeFactory> dependencyGraph, NodeFactory nodeFactory, IEnumerable <ICompilationRootProvider> roots, ILProvider ilProvider, Logger logger, DevirtualizationManager devirtualizationManager, IEnumerable <string> inputFiles, string compositeRootPath, InstructionSetSupport instructionSetSupport, bool resilient, bool generateMapFile, bool generateMapCsvFile, bool generatePdbFile, string pdbPath, bool generatePerfMapFile, string perfMapPath, int parallelism, ProfileDataManager profileData, ReadyToRunMethodLayoutAlgorithm methodLayoutAlgorithm, ReadyToRunFileLayoutAlgorithm fileLayoutAlgorithm, int customPESectionAlignment, bool verifyTypeAndFieldLayout) : base( dependencyGraph, nodeFactory, roots, ilProvider, devirtualizationManager, modulesBeingInstrumented: nodeFactory.CompilationModuleGroup.CompilationModuleSet, logger, instructionSetSupport) { _resilient = resilient; _parallelism = parallelism; _generateMapFile = generateMapFile; _generateMapCsvFile = generateMapCsvFile; _generatePdbFile = generatePdbFile; _pdbPath = pdbPath; _generatePerfMapFile = generatePerfMapFile; _perfMapPath = perfMapPath; _customPESectionAlignment = customPESectionAlignment; SymbolNodeFactory = new ReadyToRunSymbolNodeFactory(nodeFactory, verifyTypeAndFieldLayout); _corInfoImpls = new ConditionalWeakTable <Thread, CorInfoImpl>(); _inputFiles = inputFiles; _compositeRootPath = compositeRootPath; CompilationModuleGroup = (ReadyToRunCompilationModuleGroupBase)nodeFactory.CompilationModuleGroup; // Generate baseline support specification for InstructionSetSupport. This will prevent usage of the generated // code if the runtime environment doesn't support the specified instruction set string instructionSetSupportString = ReadyToRunInstructionSetSupportSignature.ToInstructionSetSupportString(instructionSetSupport); ReadyToRunInstructionSetSupportSignature instructionSetSupportSig = new ReadyToRunInstructionSetSupportSignature(instructionSetSupportString); _dependencyGraph.AddRoot(new Import(NodeFactory.EagerImports, instructionSetSupportSig), "Baseline instruction set support"); _profileData = profileData; _fileLayoutOptimizer = new ReadyToRunFileLayoutOptimizer(methodLayoutAlgorithm, fileLayoutAlgorithm, profileData, _nodeFactory); }
public ReadyToRunFileLayoutOptimizer(ReadyToRunMethodLayoutAlgorithm methodAlgorithm, ReadyToRunFileLayoutAlgorithm fileAlgorithm, ProfileDataManager profileData, NodeFactory nodeFactory) { _methodLayoutAlgorithm = methodAlgorithm; _fileLayoutAlgorithm = fileAlgorithm; _profileData = profileData; _nodeFactory = nodeFactory; }
private void ProcessCommandLine(string[] args) { PerfEventSource.StartStopEvents.CommandLineProcessingStart(); _commandLineOptions = new CommandLineOptions(args); PerfEventSource.StartStopEvents.CommandLineProcessingStop(); if (_commandLineOptions.Help) { return; } if (_commandLineOptions.WaitForDebugger) { Console.WriteLine(SR.WaitingForDebuggerAttach); Console.ReadLine(); } if (_commandLineOptions.CompileBubbleGenerics) { if (!_commandLineOptions.CompositeOrInputBubble) { Console.WriteLine(SR.WarningIgnoringBubbleGenerics); _commandLineOptions.CompileBubbleGenerics = false; } } _optimizationMode = OptimizationMode.None; if (_commandLineOptions.OptimizeDisabled) { if (_commandLineOptions.Optimize || _commandLineOptions.OptimizeSpace || _commandLineOptions.OptimizeTime) { Console.WriteLine(SR.WarningOverridingOptimize); } } else if (_commandLineOptions.OptimizeSpace) { if (_commandLineOptions.OptimizeTime) { Console.WriteLine(SR.WarningOverridingOptimizeSpace); } _optimizationMode = OptimizationMode.PreferSize; } else if (_commandLineOptions.OptimizeTime) { _optimizationMode = OptimizationMode.PreferSpeed; } else if (_commandLineOptions.Optimize) { _optimizationMode = OptimizationMode.Blended; } foreach (var input in _commandLineOptions.InputFilePaths) { Helpers.AppendExpandedPaths(_inputFilePaths, input, true); } foreach (var input in _commandLineOptions.UnrootedInputFilePaths) { Helpers.AppendExpandedPaths(_unrootedInputFilePaths, input, true); } foreach (var reference in _commandLineOptions.ReferenceFilePaths) { Helpers.AppendExpandedPaths(_referenceFilePaths, reference, false); } foreach (var reference in _commandLineOptions.InputBubbleReferenceFilePaths) { Helpers.AppendExpandedPaths(_inputbubblereferenceFilePaths, reference, false); } int alignment = _commandLineOptions.CustomPESectionAlignment; if (alignment != 0) { // Must be a power of two and >= 4096 if (alignment < 4096 || (alignment & (alignment - 1)) != 0) { throw new CommandLineException(SR.InvalidCustomPESectionAlignment); } } if (_commandLineOptions.MethodLayout != null) { _methodLayout = _commandLineOptions.MethodLayout.ToLowerInvariant() switch { "defaultsort" => ReadyToRunMethodLayoutAlgorithm.DefaultSort, "exclusiveweight" => ReadyToRunMethodLayoutAlgorithm.ExclusiveWeight, "hotcold" => ReadyToRunMethodLayoutAlgorithm.HotCold, "hotwarmcold" => ReadyToRunMethodLayoutAlgorithm.HotWarmCold, "callfrequency" => ReadyToRunMethodLayoutAlgorithm.CallFrequency, "pettishansen" => ReadyToRunMethodLayoutAlgorithm.PettisHansen, _ => throw new CommandLineException(SR.InvalidMethodLayout) }; } if (_commandLineOptions.FileLayout != null) { _fileLayout = _commandLineOptions.FileLayout.ToLowerInvariant() switch { "defaultsort" => ReadyToRunFileLayoutAlgorithm.DefaultSort, "methodorder" => ReadyToRunFileLayoutAlgorithm.MethodOrder, _ => throw new CommandLineException(SR.InvalidFileLayout) }; } }
public ReadyToRunCodegenCompilationBuilder FileLayoutAlgorithms(ReadyToRunMethodLayoutAlgorithm r2rMethodLayoutAlgorithm, ReadyToRunFileLayoutAlgorithm r2rFileLayoutAlgorithm) { _r2rMethodLayoutAlgorithm = r2rMethodLayoutAlgorithm; _r2rFileLayoutAlgorithm = r2rFileLayoutAlgorithm; return(this); }