xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.48k stars 515 forks source link

[.NET] Missing linker optimizations #11447

Open sbomer opened 3 years ago

sbomer commented 3 years ago

The .NET 6 linker no longer runs TypeMapStep for assemblies up-front. Instead the linker discovers base types on-demand (and the known overrides at any given point may be incomplete).

CoreTypeMapStep is not part of the .NET 6 macios linker pipeline, so some optimizations are not enabled:

edit: another missed opportunity is that CollectUnmarkedMembersSubStep runs before MarkStep so it will effectively track all members. Ideally this step would run after Mark.

spouliot commented 3 years ago

CoreTypeMapStep also control the possible removal of the dynamic registrar from the final app. I'm moving this out of CoreTypeMapStep since it has no real interaction with the base type (or other code / optimization).

However it does, like other parts, assume all potential assemblies are known/loaded to make the decision (to keep or not the dynamic registrar). That decision does influence the optimization done later (before at at marking time).