Skip to content

Skip generating and retaining stripped ReadyToRun debug info - #137037

Merged
davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:skip-stripped-r2r-debug-info
Nov 6, 2026
Merged

davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:skip-stripped-r2r-debug-info

Conversation

@davidwrighton

Copy link
Copy Markdown
Member

Summary

When --strip-debug-info is selected, crossgen2 currently still asks the JIT to generate debug information, copies the native location/variable records, and serializes them before discarding the debug-info table.

Skip that unused work:

  • Set CORJIT_FLAG_DEBUG_INFO only when debug information will be emitted. Keep CORJIT_FLAG_DEBUG_CODE independent so unoptimized compilation retains its existing behavior.
  • Avoid copying stripped location and variable records, while still freeing the native buffers supplied by the JIT.
  • Avoid serializing stripped location and variable records into method nodes. Leave NativeAOT's shared publishing path unchanged.

Tests cover stripped/retained output, optimized/unoptimized compilation, empty/nonempty JIT callbacks, and the actual debug-generation flags reported by a Checked JIT. The existing Wasm output test also gains a stripped-debug-info case.

Validation

Linux x64, based on 0894f48862a:

  • ./build.sh clr+libs+host -rc checked -lc release - clean baseline passed, zero warnings/errors.
  • ./build.sh -s clr.r2rtests -test -rc checked -lc release '/p:XUnitMethodName=*DebugInfo*' - before the product change, the runner executed the full suite despite the requested filter: 206 total, 187 passed, 15 skipped, and exactly four expected new regression failures. The failures were the two stripped debug-generation cases and the two stripped callback-copy cases.
  • ./build.sh -s clr.r2rtests -test -rc checked -lc release - changed compiler built successfully; 206 total, 191 passed, 15 skipped, zero failures, zero build warnings/errors. All 12 new theory cases ran and passed.
  • ./dotnet.sh build src/coreclr/tools/aot/ILCompiler.RyuJit/ILCompiler.RyuJit.csproj -c Checked - passed, zero warnings/errors, checking the shared source's NativeAOT configuration.
  • git diff --check - passed.

Browser/Wasm execution, Windows, and other target architectures were not run locally; the Wasm-specific test is among the conditional skips.

Compiler-cost diagnostic

Compared the baseline and changed Checked crossgen2 builds compiling the same fresh CoreLib IL and references with --optimize --parallelism 4 --targetos linux --targetarch x64, with and without --strip-debug-info. Linux/WSL2, Intel Core i7-7800X, 12 logical CPUs. Five fresh processes per build/configuration after discarding one warmup each, alternating baseline/changed order; no concurrent builds. These are end-to-end compiler measurements, not BenchmarkDotNet results or a statistical-significance claim.

Debug information Baseline median time Changed median time Baseline median peak RSS Changed median peak RSS
Stripped 15.52 s 15.27 s 457,076 KiB 489,348 KiB
Retained 15.87 s 15.90 s 478,392 KiB 472,996 KiB

This sample does not demonstrate a peak-memory improvement: stripped peak RSS was higher, with individual runs ranging from 448,300 to 494,212 KiB on baseline and 452,284 to 514,664 KiB with the change. The allocation-skipping tests verify the removed copies directly; process-level RSS remains variable.

All compiler invocations succeeded. Outputs were byte-for-byte identical between baseline and changed builds in each configuration: 13,900,800 bytes stripped and 15,115,264 bytes retained.

Note

This pull request was prepared with GitHub Copilot.

Only request JIT debug information when it will be emitted. Skip copying and serializing stripped location and variable records while preserving native buffer ownership and NativeAOT behavior.

Cover stripped and retained output, optimized and unoptimized compilation, empty callbacks, and Checked JIT debug-generation flags.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: dd2ba419-783f-41d0-a638-82f3fbde9ea9
@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.

Remove the redundant publishing guard, assert the JIT callback invariant, and drop the reflection-based callback test.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: dd6ed1f7-f085-4a84-9769-9cc1fab81e69
@davidwrighton
davidwrighton merged commit 8cdbec1 into dotnet:main Nov 6, 2026
102 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 7, 2026
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.

2 participants