Handle Mono AOT typeload recovery for missing fields#129657
Draft
vitek-karas wants to merge 4 commits into
Draft
Handle Mono AOT typeload recovery for missing fields#129657vitek-karas wants to merge 4 commits into
vitek-karas wants to merge 4 commits into
Conversation
Add an iOS functional test that covers typeload recovery scenarios during AOT compilation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @akoeplinger, @matouskozak, @simonrozsival |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Mono’s IL->IR pipeline to better recover from AOT field-resolution typeload failures by clearing lingering MonoError state after the failure is lowered into runtime-throw IR. It also introduces a new iOS simulator functional test app (plus helper “contract/stub” assemblies) intended to exercise the missing-field recovery scenarios.
Changes:
- Mono AOT: clear pending
cfg->errorafter field-resolution typeload recovery is emitted duringldfld/ldsfld/...handling. - Add an iOS simulator functional test app plus helper projects (contract + stub assemblies, and a repro core library) to reproduce the scenarios.
- Add MSBuild logic in the test project to build the stub and swap
ReproContracts.dllin the linked/published inputs before AOT compilation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mono/mono/mini/method-to-ir.c | Clears cfg->error after lowering AOT field-resolution failures into runtime throw IR. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/iOS.Simulator.AotTypeLoadRecovery.Test.csproj | New iOS simulator functional test project; builds & swaps stub contract assembly before AOT. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/Program.cs | Test app entrypoint; runs the probe and exits with the expected code. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/AotTypeLoadRecoveryProbe.cs | Calls into the repro harness (separated from Program). |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/ReproCore/ReproCore.csproj | Helper library containing the IL patterns used to exercise typeload recovery. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/ReproCore/AotTypeLoadRecoveryHarness.cs | Aggregates the scenario harnesses. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/ReproCore/StorePathVariant.cs | One scenario variant producing specific IL patterns (store path). |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/ReproCore/InitObjTypeLoadVariant.cs | One scenario variant producing initobj-related IL patterns. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/ReproCore/LoadSideInlineVariant.cs | One scenario variant focused on inline/load-side field access patterns. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/Contracts/ReproContracts/ReproContracts.Contract.csproj | Contract assembly project used by the repro. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/Contracts/ReproContracts/Contract.cs | Contract surface (types/fields) referenced by the repro code. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/Stubs/ReproContracts/ReproContracts.Stub.csproj | Stub assembly project used for swapping during AOT compilation. |
| src/tests/FunctionalTests/iOS/Simulator/AotTypeLoadRecovery/Stubs/ReproContracts/Placeholder.cs | Stub type definitions (currently incomplete vs contract). |
Keep the store-path probe's contract types in the stub assembly so the shared test app still reaches the intended missing-field scenarios while leaving the initobj case as the missing-type probe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only clear the expected recoverable field-resolution metadata errors after lowering the failure into runtime throw IR. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the original store-path trigger shape while letting each scenario run to its expected runtime failure without aborting the app. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing