Figure out Debug build configuration for R2R
- Dominant language
- C#
- Stars
- 2.9k
- Forks
- 576
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 123
Description
### Context
https://github.com/dotnet/macios/pull/24437 (https://github.com/dotnet/macios/pull/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)
https://github.com/dotnet/macios/pull/25583 We r2r only SPC.dll due to excessive size
https://github.com/dotnet/macios/pull/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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the linked PRs 24437, 24725, 25583, and 25787 to understand the existing R2R configuration, then reproduce the issue using the linked maui-debug-r2r project. Review the Android profiling infrastructure and determine the scope of the three listed work items. Done means an agreed Debug-build configuration that addresses the profiling, R2R flexibility, and build integration requirements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, mobile-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100