Add crossgen2 --strip-il-bodies runtime-async regression test#130075
Open
kotlarmilos wants to merge 1 commit into
Open
Add crossgen2 --strip-il-bodies runtime-async regression test#130075kotlarmilos wants to merge 1 commit into
kotlarmilos wants to merge 1 commit into
Conversation
Contributor
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
427550e to
c61119e
Compare
Adds 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
50c77f3
Compare
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.
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