Preserve IL for CoreCLR interpreter fallback on Apple mobile#130622
Preserve IL for CoreCLR interpreter fallback on Apple mobile#130622kotlarmilos with Copilot wants to merge 7 commits into
Conversation
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>
|
/azp run runtime-extra-platforms |
|
Azure Pipelines successfully started running 1 pipeline(s). |
This sounds like a bug in how we produce the R2R images for use with interpreter. The instruction set should be fixed in this case, and we should never reject the native code. If the actual machine supports more instruction set extensions that the fixed set, we should ignore them. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 19812166-4b05-40cc-9a81-8b80b909e10b
There was a problem hiding this comment.
Pull request overview
This PR adjusts composite ReadyToRun IL-stripping behavior so IL is retained when it may be needed at runtime (notably for interpreter fallback scenarios), and tightens instruction-set handling on “fixed instruction set” platforms (Apple mobile / browser), with added ReadyToRun test coverage.
Changes:
- Removes temporary project-level
PublishReadyToRunStripILBodies=falseopt-outs from several test projects. - Introduces a shared “fixed instruction set platform” classification and uses it to adjust instruction set support encoding and per-method fixup generation.
- Preserves IL for methods that have per-method instruction-set support fixups, and adds/extends ReadyToRun tests to validate stripping/preservation behavior across target configurations.
Show a summary per file
| File | Description |
|---|---|
| src/tests/JIT/Regression/Regression_o_2.csproj | Removes a project-level opt-out from ReadyToRun IL stripping. |
| src/libraries/System.Reflection.Metadata/tests/System.Reflection.Metadata.Tests.csproj | Removes a project-level opt-out from ReadyToRun IL stripping. |
| src/libraries/System.Reflection.Metadata/tests/Metadata/Decoding/SignatureDecoderTests.cs | Updates test logic to recognize an additional stripped-IL sentinel pattern. |
| src/libraries/System.IO.Hashing/tests/System.IO.Hashing.Tests.csproj | Removes a project-level opt-out from ReadyToRun IL stripping. |
| src/coreclr/tools/Common/TypeSystem/Common/TargetDetails.cs | Adds a helper to classify fixed-instruction-set target OSes. |
| src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | Skips unsupported-ISA-based per-method fixup work on fixed-instruction-set platforms; adjusts fixup support construction accordingly. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/ReadyToRunCodegenCompilation.cs | Uses a fixed-instruction-set-aware baseline instruction set support signature; plumbs per-method-fixup method set into component rewriting. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRunCodegenNodeFactory.cs | Collects methods that carry per-method instruction-set support fixups while building the compiled-method definition set. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun/Compiler/DependencyAnalysis/ReadyToRun/CopiedMethodILNode.cs | Preserves IL for methods known to have per-method instruction-set support fixups during strip-IL processing. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/RuntimeAsync/StripILBodies.cs | Adds a runtime-checked-instruction-set probe method used by strip/preserve IL tests. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/R2RTestSuites.cs | Extends strip-IL test coverage and adds an iOS-targeted validation case for fixed-instruction-set behavior. |
| src/coreclr/tools/aot/crossgen2/Program.cs | Centralizes fixed-instruction-set detection and uses it to disable optimistic ISA defaults and Vector optimism accordingly. |
Copilot's findings
- Files reviewed: 12/12 changed files
- Comments generated: 1
Updated the PR to keep IL stripping enabled on Apple and fix the known fallback paths. Crossgen2 now treats Apple mobile and browser as fixed instruction-set targets, so additional runtime ISA support does not reject valid baseline native code. Non-fixed targets still preserve IL for methods with per-method ISA fixups. Custom AssemblyLoadContext scenarios retain scoped project opt-outs which would require the assembly-level exclusion mentioned in #130620. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 19812166-4b05-40cc-9a81-8b80b909e10b
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
| /// <summary> | ||
| /// Returns <see langword="true"/> for target OSes where the runtime cannot JIT new code, so ISA support is treated as fixed. | ||
| /// </summary> | ||
| public static bool IsFixedInstructionSetPlatform(TargetOS operatingSystem) => | ||
| operatingSystem is TargetOS.iOS or TargetOS.tvOS | ||
| or TargetOS.iOSSimulator or TargetOS.tvOSSimulator | ||
| or TargetOS.MacCatalyst or TargetOS.Browser; |
|
/azp run runtime-extra-platforms |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Apple mobile composite ReadyToRun publishing could strip IL later required by the CoreCLR interpreter when compiled code is rejected or unavailable in a custom load context.
Stripping policy
Coverage