Skip to content

Conversation

@rolfbjarne
Copy link
Member

Pending:

  • Create frameworks for coreclr's dylibs.
  • ...

Copy link
Contributor

Copilot AI left a 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

rolfbjarne and others added 11 commits December 12, 2025 19:07
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.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #55f9501] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #55f9501] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #55f9501] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #55f9501] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #55f9501] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #55f9501] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #55f9501] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

❌ [CI Build #55f9501] Tests on macOS arm64 - Mac Tahoe (26) failed ❌

Failed tests are:

  • monotouch-test

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #55f9501] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 126 tests passed.

Failures

❌ introspection tests

1 tests failed, 8 tests passed.

Failed tests

  • introspection/tvOS - simulator/CoreCLR: Crashed

Html Report (VSDrops) Download

❌ xcframework tests

1 tests failed, 3 tests passed.

Failed tests

  • xcframework-test/tvOS - simulator/Debug: Crashed

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 13 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 55f95010f0e7d43d3303265aa29fff58fd313896 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants