Skip to content

Figure out Debug build configuration for R2R #25830

Description

@BrzVlad

Context

#24437 (#24725) Added support for R2R which, on debug builds, does a compilation of all assemblies except user assemblies (these are considered assemblies that don't have a NuGet package id)

#25583 We r2r only SPC.dll due to excessive size

#25787 Above change had to be reverted due to x64 issues, enabled only on arm64 builds now.

Bug

For whatever reason, during the revert, this exposed a problem with the original filtering of assemblies. Normally, a composite r2r compilation receives the full set of app assemblies (this is a self contained only mode) and compiles everything. Doing an incomplete r2r compilation like we do on debug build is non standard and we are not even passing the user assemblies as a reference. This can lead to r2r tripping up when trying to load some types (only when using ReadyToRunVisibilityRootProvider). Reproduced this standalone in https://github.com/BrzVlad/repros/tree/main/maui-debug-r2r.

With the partial revert, this bug would exist only on x64 builds

Future Debug build configuration

I believe we can do better than using r2r only for SPC.dll. On android we have some infrastructure for building a profile to be passed to r2r. I believe we can do the same for iOS Debug builds, so we can obtain even better performance at the cost of minimal size increase.

Work items

  • Setup infrastructure to obtain a profile from a MAUI iOS app. Rather than only getting a startup profile, we would probably want to automate the app to navigate through various common controls so we get a larger profile
  • Improve flexibility for r2r. I believe the configuration we are aiming for is to pass all assemblies to the composite r2r mode, use partial mode so that we only r2r methods from the profile, but we would also want to ensure that everything from SPC.dll is still compiled (this goes against the current partial mode, we would need to add a new flag to root SPC.dll)
  • Make the build use this mode instead. This would also fix any potential r2r referencing issues like the one from the linked repro.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CoreCLRBugs related to our CoreCLR support

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions