Skip to content

JIT: ignore finally-entry backedges when fixing continuation weights - #135837

Merged
EgorBo merged 2 commits into
dotnet:mainfrom
EgorBo:fix/jit-135819-finally-profile
Oct 20, 2026
Merged

EgorBo merged 2 commits into
dotnet:mainfrom
EgorBo:fix/jit-135819-finally-profile

Conversation

@EgorBo

@EgorBo EgorBo commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

A finally handler can have ordinary backedge predecessors, not just callfinallies. Filter them before accessing the paired continuation, matching EH-edge construction and avoiding a null dereference.

Fixes #135819

No diffs

A finally handler can have ordinary backedge predecessors, not just callfinallies. Filter them before accessing the paired continuation, matching EH-edge construction and avoiding a null dereference.

Fixes dotnet#135819

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6ec7c151-8b7f-4bf9-8b1a-8c601a2965ec
@github-actions github-actions Bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Oct 15, 2026
@EgorBo
EgorBo requested a balanced review from Copilot October 15, 2026 01:55
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 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: @JulieLeeMSFT, @jakobbotsch
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.

🔵 Needs a closer look

Execution of the regression under profile-weighted compilation remains unverified and needs human confirmation.

0 open findings

What changed in this PR

Fixes the JIT crash described in #135819 by excluding ordinary finally-handler backedges from continuation-weight updates.

Changes:

  • Restricts continuation processing to BBJ_CALLFINALLY predecessors.
  • Adds a regression test with an infinite loop inside a finally handler.
File Description
src/​tests/​JIT/​Regression_ro_2/​Runtime_135819.cs Adds the reported crash scenario as a regression test.
src/​coreclr/​jit/​importer.cpp Skips non-callfinally predecessors before accessing continuations.

🧠 Review effort: Balanced

@EgorBo
EgorBo requested a review from a team October 15, 2026 13:09
@EgorBo

EgorBo commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib, trivial change, no diffs

@adamperlin adamperlin 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.

LGTM overall, one nit about naming

Comment thread src/coreclr/jit/importer.cpp Resolved
@EgorBo
EgorBo enabled auto-merge (squash) October 20, 2026 13:54
@EgorBo
EgorBo merged commit 9e9a54c into dotnet:main Oct 20, 2026
134 of 136 checks passed
@EgorBo
EgorBo deleted the fix/jit-135819-finally-profile branch October 20, 2026 14:00
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: (bug) crash (null deref in impFixPredLists) for finally { while (true) {} } when profile weights are used

3 participants