Skip to content

JIT: use funclet iterator in genCodeForBBlist#126588

Open
AndyAyersMS wants to merge 2 commits intodotnet:mainfrom
AndyAyersMS:FuncletIteratorInCodegen
Open

JIT: use funclet iterator in genCodeForBBlist#126588
AndyAyersMS wants to merge 2 commits intodotnet:mainfrom
AndyAyersMS:FuncletIteratorInCodegen

Conversation

@AndyAyersMS
Copy link
Copy Markdown
Member

Also remove the special case 'next block' handling for callfinallyret.

Also remove the special case 'next block' handling for callfinallyret.
Copilot AI review requested due to automatic review settings April 6, 2026 20:59
@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 Apr 6, 2026
@AndyAyersMS
Copy link
Copy Markdown
Member Author

@dotnet/jit-contrib PTAL

This should make it a little easier to handle some funclet codegen issues in Wasm.

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors CoreCLR JIT linear codegen to iterate over funclets using the existing Compiler::Funcs() / FuncInfoDsc::Blocks() ranges, and simplifies BBJ_CALLFINALLY handling by removing “skip-next-block” return mechanics (and instead skipping BBJ_CALLFINALLYRET blocks in block codegen).

Changes:

  • Switch genCodeForBBlist from a single basic-block walk to per-funclet iteration (genCodeForFunclet + genCodeForBlock).
  • Change genCallFinally and genEmitEndBlock from returning BasicBlock* to void, removing special “next block” handling for BBJ_CALLFINALLY.
  • Skip BBJ_CALLFINALLYRET blocks in genCodeForBlock since they contain no code.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/coreclr/jit/codegenlinear.cpp Refactors the main block iteration into funclet/block helpers; removes “skip-ahead” return flow.
src/coreclr/jit/codegen.h Updates declarations for new helpers and changes return types of genEmitEndBlock/genCallFinally.
src/coreclr/jit/codegenxarch.cpp Updates genCallFinally to void and removes skip-return logic.
src/coreclr/jit/codegenarm.cpp Updates genCallFinally signature/returns to match new void contract.
src/coreclr/jit/codegenarm64.cpp Updates genCallFinally signature/returns to match new void contract.
src/coreclr/jit/codegenloongarch64.cpp Updates genCallFinally signature/returns to match new void contract.
src/coreclr/jit/codegenriscv64.cpp Updates genCallFinally signature/returns to match new void contract.
src/coreclr/jit/codegenwasm.cpp Updates genCallFinally signature to void (still NYI).

Copy link
Copy Markdown
Member

@EgorBo EgorBo left a comment

Choose a reason for hiding this comment

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

LGTM if CI/diffs are happy (needs a rerun)

@AndyAyersMS AndyAyersMS closed this Apr 7, 2026
@AndyAyersMS AndyAyersMS reopened this Apr 7, 2026
@AndyAyersMS
Copy link
Copy Markdown
Member Author

Should be no diff.

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.

3 participants