Uh oh!
There was an error while loading. Please reload this page.
Add crossgen2 --strip-il-bodies runtime-async regression test - #130075
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new ILCompiler.ReadyToRun.Tests regression test that validates crossgen2 --strip-il-bodies behavior under runtime-async, by inspecting the emitted component MSIL and asserting which methods should keep vs. lose their IL.
Changes:
- Extend the R2R test runner option model to include
--strip-il-bodies. - Add MSIL IL-body inspection helpers (
MethodILIsStripped/MethodILIsPresent) and a new runtime-async test case (StripILBodies.cs) plus an xUnit test that asserts strip/preserve decisions. - Modify global
UseMonoRuntimebehavior inDirectory.Build.propsfor*-android/ios/tvos/maccatalystTFMs whenTargetsMobile != true.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCasesRunner/R2RResultChecker.cs | Adds helpers to read method IL from the component MSIL and assert stripped vs present bodies. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCasesRunner/R2RDriver.cs | Adds a new modeled crossgen2 option mapping for --strip-il-bodies. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/RuntimeAsync/StripILBodies.cs | New embedded test input assembly with a mix of async, non-async Task/ValueTask, and generic cases. |
| src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/TestCases/R2RTestSuites.cs | New [Fact] that runs a composite crossgen2 compile with runtime-async + --strip-il-bodies and asserts IL preservation/stripping. |
| Directory.Build.props | Changes global defaulting of UseMonoRuntime for mobile-suffixed TFMs when not TargetsMobile. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 4
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
427550e to
c61119eCompareAdds an ILCompiler.ReadyToRun.Tests case that crossgen2-composites a small runtime-async assembly with --strip-il-bodies and inspects the emitted component MSIL to assert every branch of the strip decision, covering the regression from dotnet#129813 fixed by dotnet#129884. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c61119e to
50c77f3Compare…enceEqual The untyped [0x14, 0x7A] collection expression prevented the MemoryExtensions.SequenceEqual<byte> overload from binding, causing the CLR_Tools_Tests leg to fail to compile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
kotlarmilos
commented
Jul 2, 2026
|
Uh oh!
There was an error while loading. Please reload this page.
… 0x24 stub PR dotnet#130025 changes the crossgen2 --strip-il-bodies stub from ldnull; throw (0x14 0x7A) to an invalid opcode (0xFE 0x24). Update the regression test added in PR dotnet#130075 to check for the new sentinel bytes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
## Description The `--strip-il-bodies` optimization in crossgen2 is applied when building the composite ReadyToRun images that ship in the Apple mobile runtime packs, and in #129813 it regressed by stripping the IL of non-async `Task`/`ValueTask`-returning methods. That IL is still needed, because with runtime-async enabled the runtime compiles a runtime-async variant of such a method from its IL, so replacing it with a `ldnull` throw stub threw `NullReferenceException` on the mobile packs until #129884 narrowed the pass via `MayNeedILAtRuntime`. This PR adds a deterministic `ILCompiler.ReadyToRun.Tests` tests that inspect the emitted component MSIL to assert every branch of the strip logic. Non-async `Task<T>`/`ValueTask<T>`/`Task`/`ValueTask`-returning methods, a generic method, and a method on a generic type keep their IL, while plain methods and async `Task<T>`/`ValueTask` methods are still stripped. TODO: This PR should be aligned with #130025 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
The
--strip-il-bodiesoptimization in crossgen2 is applied when building the composite ReadyToRun images that ship in the Apple mobile runtime packs, and in #129813 it regressed by stripping the IL of non-asyncTask/ValueTask-returning methods. That IL is still needed, because with runtime-async enabled the runtime compiles a runtime-async variant of such a method from its IL, so replacing it with aldnullthrow stub threwNullReferenceExceptionon the mobile packs until #129884 narrowed the pass viaMayNeedILAtRuntime.This PR adds a deterministic
ILCompiler.ReadyToRun.Teststests that inspect the emitted component MSIL to assert every branch of the strip logic. Non-asyncTask<T>/ValueTask<T>/Task/ValueTask-returning methods, a generic method, and a method on a generic type keep their IL, while plain methods and asyncTask<T>/ValueTaskmethods are still stripped.TODO: This PR should be aligned with #130025