-
Notifications
You must be signed in to change notification settings - Fork 549
[dotnet] Add support for ReadyToRun. #24437
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
base: net11.0
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR adds ReadyToRun (R2R) support for CoreCLR on Apple mobile platforms (iOS, tvOS). ReadyToRun is an ahead-of-time (AOT) compilation technology that improves app startup performance by pre-compiling managed assemblies to native code. The implementation involves integrating CoreCLR's R2R infrastructure through a new host runtime contract interface, generating composite R2R images into frameworks or dynamic libraries, and enabling the feature by default for non-macOS CoreCLR builds.
Key Changes
- Added infrastructure to pass PublishReadyToRun configuration through the build pipeline
- Implemented native code integration for R2R via the host_runtime_contract interface
- Created MSBuild targets to build R2R composite images and link them into frameworks or dylibs
- Removed libclrjit.dylib dependency when R2R is enabled (replaced with R2R interpretation)
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/dotnet-linker/LinkerConfiguration.cs | Adds parsing for PublishReadyToRun configuration property |
| tools/common/Target.cs | Generates extern declarations for RTR_HEADER symbol in generated main.m file |
| tools/common/Application.cs | Adds PublishReadyToRun nullable boolean property to Application class |
| runtime/xamarin/runtime.h | Changes xamarin_pinvoke_override return type to const void* |
| runtime/xamarin/main.h | Declares xamarin_rtr_header global variable |
| runtime/runtime.m | Implements R2R integration via host_runtime_contract and adds dyld image size calculation |
| runtime/coreclr-bridge.m | Fixes logging bug where wrong variable was being accessed |
| runtime/Makefile | Updates to download host_runtime_contract.h header from dotnet/runtime |
| runtime/.gitignore | Ignores the downloaded host_runtime_contract.h file |
| msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs | Adds IsFramework property and CFBundlePackageType support for frameworks |
| dotnet/targets/Xamarin.Shared.Sdk.targets | Passes PublishReadyToRun to linker, removes libclrjit.dylib, imports R2R targets |
| dotnet/targets/Xamarin.Shared.Sdk.props | Sets R2R as default for CoreCLR mobile builds, adds environment variable fallback |
| dotnet/targets/Microsoft.Sdk.R2R.targets | New file implementing R2R composite image building and framework/dylib creation |
| dotnet/Makefile | Includes new Microsoft.Sdk.R2R.targets in SDK package |
| tests/dotnet/UnitTests/AppSizeTest.cs | Removes test ignore attribute and fixes assertion message logic |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-R2R-size.txt | New baseline for R2R app sizes |
| tests/dotnet/UnitTests/expected/iOS-CoreCLR-Interpreter-size.txt | Updated baseline reflecting removal of libclrjit.dylib |
Also download the latest version of coreclrhost.h.
- Introduced ReadyToRun configuration in Xamarin.Shared.Sdk.props. - Updated bundler environment variables in Xamarin.Shared.Sdk.targets to support ReadyToRun. - Added host_runtime_contract.h to the build process in Makefile. - Updated coreclr-bridge.m and runtime.m for R2R image handling and logging. - Updated runtime.h to reflect changes in the xamarin_pinvoke_override function signature. - Adjusted how the native main function is generated to load the RTR_HEADER symbol when using ReadyToRun.
…dyToRun compiler's composite output. And then link with and bundle the .framework or .dylib we created.
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
5d67786 to
270a76b
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [CI Build #55f9501] Build passed (Build packages) ✅Pipeline on Agent |
✅ [PR Build #55f9501] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #55f9501] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #55f9501] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #55f9501] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #55f9501] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #55f9501] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
❌ [CI Build #55f9501] Tests on macOS arm64 - Mac Tahoe (26) failed ❌Failed tests are:
Pipeline on Agent |
🔥 [CI Build #55f9501] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 126 tests passed. Failures❌ introspection tests1 tests failed, 8 tests passed.Failed tests
Html Report (VSDrops) Download ❌ xcframework tests1 tests failed, 3 tests passed.Failed tests
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Pending: