From: Tomáš Rylek Date: Mon, 6 Apr 2020 22:33:51 +0000 (+0200) Subject: SuperIlc fixes to unblock composite build using the shared library (#34430) X-Git-Tag: submit/tizen/20210909.063632~8730 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1d4e9451b518c9cd83fc1bcb67587a02ba677a75;p=platform%2Fupstream%2Fdotnet%2Fruntime.git SuperIlc fixes to unblock composite build using the shared library (#34430) --- diff --git a/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolder.cs b/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolder.cs index 1ca1b4a..319b4c9 100644 --- a/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolder.cs +++ b/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolder.cs @@ -152,7 +152,7 @@ namespace ReadyToRun.SuperIlc return null; } - if (options.Composite) + if (options.Composite && !(options.Framework || options.UseFramework)) { // In composite mode we copy the native runtime to the app folder and pretend that is CORE_ROOT, // otherwise CoreRun picks up the original MSIL versions of framework assemblies from CORE_ROOT diff --git a/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolderSet.cs b/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolderSet.cs index 4f7157a..cf0dd1d 100644 --- a/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolderSet.cs +++ b/src/coreclr/src/tools/ReadyToRun.SuperIlc/BuildFolderSet.cs @@ -260,7 +260,7 @@ namespace ReadyToRun.SuperIlc if (inputFrameworkDlls.Count > 0) { - string outputFileName = runner.GetOutputFileName(_options.CoreRootDirectory.FullName, "framework"); + string outputFileName = runner.GetOutputFileName(_options.CoreRootDirectory.FullName, "framework-r2r.dll"); ProcessInfo compilationProcess = new ProcessInfo(new CompilationProcessConstructor(runner, outputFileName, inputFrameworkDlls)); compilationsToRun.Add(compilationProcess); processes[(int)runner.Index] = compilationProcess; diff --git a/src/coreclr/src/tools/ReadyToRun.SuperIlc/CompilerRunner.cs b/src/coreclr/src/tools/ReadyToRun.SuperIlc/CompilerRunner.cs index 05336b3..bfefd99 100644 --- a/src/coreclr/src/tools/ReadyToRun.SuperIlc/CompilerRunner.cs +++ b/src/coreclr/src/tools/ReadyToRun.SuperIlc/CompilerRunner.cs @@ -244,7 +244,7 @@ namespace ReadyToRun.SuperIlc } string coreRootDir; - if (_options.Composite) + if (_options.Composite && !(_options.Framework || _options.UseFramework)) { coreRootDir = GetOutputPath(outputRoot); } diff --git a/src/coreclr/src/tools/ReadyToRun.SuperIlc/CpaotRunner.cs b/src/coreclr/src/tools/ReadyToRun.SuperIlc/CpaotRunner.cs index 7e5c5c6..4f5c220 100644 --- a/src/coreclr/src/tools/ReadyToRun.SuperIlc/CpaotRunner.cs +++ b/src/coreclr/src/tools/ReadyToRun.SuperIlc/CpaotRunner.cs @@ -69,7 +69,7 @@ namespace ReadyToRun.SuperIlc yield return "-O"; } - if (_options.LargeBubble || _options.Composite) + if (_options.LargeBubble) { yield return "--inputbubble"; } @@ -84,27 +84,35 @@ namespace ReadyToRun.SuperIlc yield return $"--parallelism={_options.Crossgen2Parallelism}"; } - HashSet uniqueFolders = new HashSet( - RuntimeInformation.IsOSPlatform(OSPlatform.Windows) - ? StringComparer.OrdinalIgnoreCase - : StringComparer.Ordinal); + string frameworkFolder = ""; + if (_options.Framework || _options.UseFramework) + { + frameworkFolder = GetOutputPath(_options.CoreRootDirectory.FullName); + foreach (string frameworkRef in ResolveReferences(new string[] { frameworkFolder }, 'r')) + { + yield return frameworkRef; + } + } + + StringComparer pathComparer = (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal); + HashSet uniqueFolders = new HashSet(pathComparer); + foreach (string assemblyFileName in assemblyFileNames) { uniqueFolders.Add(Path.GetDirectoryName(assemblyFileName)); } uniqueFolders.UnionWith(_referenceFolders); + uniqueFolders.Remove(frameworkFolder); - foreach (string reference in ResolveReferences(uniqueFolders)) + foreach (string reference in ResolveReferences(uniqueFolders, _options.Composite ? 'u' : 'r')) { yield return reference; } } - private IEnumerable ResolveReferences(IEnumerable folders) + private IEnumerable ResolveReferences(IEnumerable folders, char referenceOption) { - char referenceOption = (_options.Composite ? 'u' : 'r'); - foreach (string referenceFolder in folders) { foreach (string reference in ComputeManagedAssemblies.GetManagedAssembliesInFolder(referenceFolder))