Skip to content

Skip tracking stripped ReadyToRun inlining metadata - #137053

Merged
jkotas merged 1 commit into
dotnet:mainfrom
davidwrighton:skip-stripped-r2r-inlining-info
Nov 7, 2026
Merged

jkotas merged 1 commit into
dotnet:mainfrom
davidwrighton:skip-stripped-r2r-inlining-info

Conversation

@davidwrighton

Copy link
Copy Markdown
Member

Summary

When --strip-inlining-info is selected, crossgen2 omits the inlining tables but still collects inlinees, merges nested-inline hash sets, copies and sorts the results into arrays, and retains those arrays on method nodes.

Skip this bookkeeping when the flag is set:

  • Do not push/pop inlinee-tracking state or collect/merge inlinee hash sets.
  • Do not create, sort, or publish inlinee arrays, which also avoids registering modules solely for inlining metadata.
  • Keep precode fixups, module activation, and cross-module IL-body/token handling active. Stripping metadata must not disable the correctness work performed by the same callbacks.

Retained-inlining-info behavior and NativeAOT's separate inlining handling are unchanged. This is independent of the debug-info change in #137037 and is based directly on main (f43900c8a9c).

Validation

Linux x64 with an existing Checked CoreCLR / Release libraries baseline:

  • ./build.sh -s clr.r2rtests -test -rc checked -lc release — passed before and after the product change: 198 total, 183 passed, 15 skipped, zero failures, zero build warnings/errors.
  • The existing basic cross-module, transitive-reference, and composite-inlining tests now cover both flag values. All six cases passed; stripped cross-module cases retain Check_IL_Body fixups and required manifest references, while inlining sections are absent. These are output-preservation checks for an internal optimization and also pass on the baseline.
  • ./dotnet.sh build src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj -c Checked — passed, zero warnings/errors.
  • git diff --check — passed.

Browser/Wasm execution, Windows, and other target architectures were not run locally.

Compiler-cost diagnostic

Compared saved baseline and changed Checked crossgen2 builds compiling the same CoreLib IL and references with --optimize --parallelism 4 --targetos linux --targetarch x64, with and without --strip-inlining-info. Linux/WSL2, Intel Core i7-7800X, 12 logical CPUs. Three measured fresh processes per build/configuration after discarding one warmup each, alternating baseline/changed order; no concurrent builds.

Inlining information Baseline median time Changed median time Baseline median peak RSS Changed median peak RSS
Stripped 15.32 s 14.99 s 515,956 KiB 516,360 KiB
Retained 15.74 s 15.38 s 513,948 KiB 500,172 KiB

These are end-to-end compiler diagnostics, not BenchmarkDotNet results or a statistical-significance claim. In particular, this sample does not demonstrate a peak-memory improvement for stripping; process RSS remains variable.

All compiler invocations succeeded. Outputs were byte-for-byte identical between baseline and changed builds within each configuration: 14,931,968 bytes stripped and 15,115,264 bytes retained.

Note

This pull request was prepared with GitHub Copilot.

Avoid inlinee hash-set tracking, nested-inline state, sorted arrays, and metadata-only module registration when --strip-inlining-info is set. Preserve callback fixups, module activation, and cross-module IL handling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: dd6ed1f7-f085-4a84-9769-9cc1fab81e69
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/crossgen-contrib
See info in area-owners.md if you want to be subscribed.

@davidwrighton
davidwrighton marked this pull request as ready for review November 5, 2026 23:51
@jkotas
jkotas requested a balanced review from Copilot November 7, 2026 05:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The stripped-mode tests can pass without the new allocation-skipping guards, leaving inlinee tracking and null InlinedMethods behavior unverified by an in-process test with retained compilation as a control.

1 open issue
What changed in this PR

This PR avoids collecting and retaining ReadyToRun inlining metadata when --strip-inlining-info is enabled, while preserving correctness-related work and NativeAOT’s separate handling.

Changes:

  • Skip inlinee tracking, nested-set merging, and inlinee-array creation and publication when metadata is stripped.
  • Preserve precode fixups, module activation, and cross-module IL-body/token handling.
  • Extend three existing test scenarios to cover stripped and retained metadata.
File Description
src/​coreclr/​tools/​Common/​JitInterface/​CorInfoImpl.cs Skip creating, sorting, and publishing stripped inlinee arrays.
src/​coreclr/​tools/​aot/​ILCompiler.ReadyToRun/​JitInterface/​CorInfoImpl.ReadyToRun.cs Guard inlinee bookkeeping without bypassing correctness work.
src/​coreclr/​tools/​aot/​ILCompiler.ReadyToRun.Tests/​TestCases/​R2RTestSuites.cs Test both flag values and verify metadata sections, fixups, and references.

Review effort: Balanced

@jkotas
jkotas merged commit 5ccf61b into dotnet:main Nov 7, 2026
104 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants