-
Notifications
You must be signed in to change notification settings - Fork 515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable deduplication of generics in Xamarin.iOS build #17766
Changes from all commits
bd340ca
39f2d8a
b80f9ea
3398ef4
3818279
902ebcc
6b31644
2940cf4
f2d1cc5
16e2f09
93d34e9
3760822
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,8 @@ protected override void TryEndProcess () | |
|
||
var app = Configuration.Application; | ||
var outputDirectory = Configuration.AOTOutputDirectory; | ||
var dedupFileName = Path.GetFileName (Configuration.DedupAssembly); | ||
var isDedupEnabled = Configuration.Target.Assemblies.Any (asm => Path.GetFileName (asm.FullPath) == dedupFileName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. Using item metadata instead to prevent comparing against a filename. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Anyway, we plan to simplify the dedup build process, so such assembly shouldn't be required soon. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That's great, it would make most of this PR unnecessary! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct, it was allowed by dotnet/runtime#83711. As it would require runtime changes and additional testing, I suggest doing it as a follow-up effort on both runtime and xamarin repositories, as outlined in dotnet/runtime#83973 (comment). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was wondering whether we could remove the dependency on the assembly filename and that we could do something like: <ItemGroup>
<ManagedAssemblyToLink Include="$(_DedupAssembly)" />
<IsDedupAssembly>true</IsDedupAssembly>
<ManagedAssemblyToLink>
</ItemGroup> but I missed the fact that the custom linker step does not have access to MSBuild item metadata at this point. My bad, and thanks for checking this out. |
||
|
||
foreach (var asm in Configuration.Target.Assemblies) { | ||
var isAOTCompiled = asm.IsAOTCompiled; | ||
|
@@ -30,6 +32,10 @@ protected override void TryEndProcess () | |
}; | ||
|
||
var input = asm.FullPath; | ||
bool? isDedupAssembly = null; | ||
if (isDedupEnabled) { | ||
isDedupAssembly = Path.GetFileName (input) == dedupFileName; | ||
} | ||
var abis = app.Abis.Select (v => v.AsString ()).ToArray (); | ||
foreach (var abi in app.Abis) { | ||
var abiString = abi.AsString (); | ||
|
@@ -38,7 +44,7 @@ protected override void TryEndProcess () | |
var aotData = Path.Combine (outputDirectory, arch, Path.GetFileNameWithoutExtension (input) + ".aotdata"); | ||
var llvmFile = Configuration.Application.IsLLVM ? Path.Combine (outputDirectory, arch, Path.GetFileName (input) + ".llvm.o") : string.Empty; | ||
var objectFile = Path.Combine (outputDirectory, arch, Path.GetFileName (input) + ".o"); | ||
app.GetAotArguments (asm.FullPath, abi, outputDirectory, aotAssembly, llvmFile, aotData, out var processArguments, out var aotArguments, Path.GetDirectoryName (Configuration.AOTCompiler)); | ||
app.GetAotArguments (asm.FullPath, abi, outputDirectory, aotAssembly, llvmFile, aotData, isDedupAssembly, out var processArguments, out var aotArguments, Path.GetDirectoryName (Configuration.AOTCompiler)); | ||
item.Metadata.Add ("Arguments", StringUtils.FormatArguments (aotArguments)); | ||
item.Metadata.Add ("ProcessArguments", StringUtils.FormatArguments (processArguments)); | ||
item.Metadata.Add ("Abi", abiString); | ||
|
@@ -47,6 +53,8 @@ protected override void TryEndProcess () | |
item.Metadata.Add ("AOTAssembly", aotAssembly); | ||
item.Metadata.Add ("LLVMFile", llvmFile); | ||
item.Metadata.Add ("ObjectFile", objectFile); | ||
if (isDedupAssembly.HasValue && isDedupAssembly.Value) | ||
item.Metadata.Add ("IsDedupAssembly", isDedupAssembly.Value.ToString ()); | ||
} | ||
|
||
assembliesToAOT.Add (item); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
isDedupAssembly
can be a nonnullable boolean type and it would simplify comparisons further.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetAotArguments
is used in legacy build as well, where dedup is not supported. VariableisDedupAssembly
could have the following values:NULL
means that dedup is not enabledFALSE
means thatdedup-skip
flag should be passed for all assembliesTRUE
means thatdedup-include
flag should be passed for a container assemblyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh right, I forgot about that case. Thanks for the explanation.
Could you please add this to the description of the PR?