镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fix pre-existing GCInfo decoder correctness issues - #136978

Merged
davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:fix/gcinfo-decoder-correctness
Nov 4, 2026
Merged

davidwrighton merged 2 commits into
dotnet:mainfrom
davidwrighton:fix/gcinfo-decoder-correctness

Conversation

@davidwrighton

@davidwrighton davidwrighton commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Fix seven pre-existing GCInfo reader defects without changing the on-disk format, GCInfo/R2R version, encoder, or Wasm-specific behavior:

  • Decode LoongArch64's normalized frame pointer as register 22, not register 2.
  • Decode RISC-V64's normalized stack pointer as register 2, not register 9, while retaining support for the older nonzero encoding.
  • Denormalize fully interruptible transition offsets before combining them with byte-based ranges.
  • Map transitions correctly at half-open range boundaries and across multiple skipped ranges, including methods without explicit interruptible ranges.
  • Measure indirect safe-point payloads using the furthest referenced bitmap end, rather than the last bitmap visited. Cover both ordinary and RLE bitmaps.
  • Consume ARM64's additional EnC fixed-frame-size field so subsequent fields remain aligned. This is a latent parser issue; ordinary crossgen2 compilation does not enable EnC.
  • Decode cDAC's outgoing/scratch parameter area before returning a header, using a separate stop point that preserves the native reverse-P/Invoke decoding boundary.

The PR contains only diagnostic/tooling decoder fixes and regression tests, based on main. It does not depend on the GCInfo v6 work in #135821.

Validation

Added 36 R2R regression cases and seven cDAC cases using the existing GCInfo v5 format. Before applying the original fixes, the new tests demonstrated 28 R2R failures and five cDAC failures. Additional review regressions verify that generic-context lookup does not read the outgoing area and that slim-header decoding does not read the safe-point count.

Both commands below were run successfully on this isolated, main-based branch with zero build warnings or errors:

./dotnet.sh build src/coreclr/tools/aot/ILCompiler.ReadyToRun.Tests/ILCompiler.ReadyToRun.Tests.csproj -c Checked /p:RuntimeConfiguration=Checked /p:LibrariesConfiguration=Release /p:CoreCLRConfiguration=Checked /t:Build,Test

Result: 179 passed, 0 failed, 15 existing skips, including all 36 new regression cases.

./dotnet.sh build src/native/managed/cdac/tests/UnitTests/Microsoft.Diagnostics.DataContractReader.Tests.csproj -c Checked /p:RuntimeConfiguration=Checked /p:LibrariesConfiguration=Release /t:Build,Test

Result: 3,969 passed, 0 failed, 0 skipped, including all seven new regression cases.

The fixtures exercise AMD64, ARM32, ARM64, LoongArch64, and RISC-V64 decoding on Linux x64; they are not native execution tests on those other architectures.

Note

This PR and its description were prepared with GitHub Copilot.

Correct architecture-specific frame registers, transition scaling and range mapping, indirect live-state payload sizes, ARM64 EnC header parsing, and lazy cDAC outgoing-area decoding. Add regressions using the existing v5 format.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 4 pipeline(s).
11 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.

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.

🟢 Approval recommended

No active review issues remain for the GCInfo decoding corrections.

No open issues 🎉

What changed in this PR

Fixes GCInfo decoding in ReadyToRun tooling and cDAC without changing the encoded format or version.

Changes:

  • Corrects architecture-specific register decoding and ARM64 EnC header parsing.
  • Fixes transition offset mapping, indirect bitmap size accounting, and cDAC header decoding order.
  • Adds 36 ReadyToRun regression cases and five cDAC cases covering the decoder fixes.
File Description
src/​native/​managed/​cdac/​tests/​UnitTests/​GCInfoHeaderTests.cs Tests outgoing-area decoding before slot lifetime access across five architectures.
src/​native/​managed/​cdac/​Microsoft.Diagnostics.DataContractReader.Contracts/​Contracts/​GCInfo/​GCInfoDecoder.cs Decodes the scratch area before returning the header.
src/​coreclr/​tools/​aot/​ILCompiler.Reflection.ReadyToRun/​GCInfoTypes.cs Corrects register mappings and defines the ARM64 EnC fixed-frame encoding base.
src/​coreclr/​tools/​aot/​ILCompiler.Reflection.ReadyToRun/​Amd64/​GcInfo.cs Fixes EnC parsing, bitmap extent tracking, and transition mapping.
src/​coreclr/​tools/​aot/​ILCompiler.ReadyToRun.Tests/​GcInfoRegressionTests.cs Adds encoded fixtures covering registers, EnC headers, transitions, and indirect bitmaps.

Review effort: Balanced

@davidwrighton
davidwrighton marked this pull request as ready for review November 4, 2026 20:03
Add a separate stack-parameter-area decode point for GetHeader while keeping ReversePInvoke aligned with the native decoder. Cover early stopping for generic-context lookups and slim headers.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@davidwrighton
davidwrighton merged commit 7496f5e into dotnet:main Nov 4, 2026
154 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 6, 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.

3 participants