Skip to content

JIT: another bit of refactoring in escape analysis #115812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AndyAyersMS
Copy link
Member

Update the transformation code to make it easier to reorder the checks in the future, for example trying to handle in-loop allocation sites.

Update the transformation code to make it easier to reorder the checks
in the future, for example trying to handle in-loop allocation sites.
@Copilot Copilot AI review requested due to automatic review settings May 21, 2025 01:12
@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 May 21, 2025
Copy link
Contributor

@Copilot 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 the escape analysis transformation logic to allow easier reordering of checks and to support additional allocation site scenarios. Key changes include introducing the AllocationCandidate structure, adding new helper functions (for both object and array allocation nodes), and tracking stack allocation counts.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/jit/objectalloc.h Introduces AllocationCandidate and reorders typedefs for clarity
src/coreclr/jit/objectalloc.cpp Updates allocation morphing logic with new helper functions and candidate handling
Comments suppressed due to low confidence (1)

src/coreclr/jit/objectalloc.h:124

  • The new AllocationCandidate structure contains several members with specific roles. Consider adding a brief inline comment or updating the documentation to explain the purpose of each member to aid future maintainers.
struct AllocationCandidate {

{
JITDUMP("Allocating V%02u on the stack\n", lclNum);
canStack = true;
if (candidate.m_bashCall)
Copy link
Preview

Copilot AI May 21, 2025

Choose a reason for hiding this comment

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

The usage of the candidate.m_bashCall flag is not immediately clear since it is only set in one allocation helper (for objects). Please add a comment explaining its intended role and why it is exclusive to certain cases to improve code clarity.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib PTAL

No diffs. Splits up one large method into smaller chunks, enabling "early return" style checks instead of a series of cascading if/then/elses.

@AndyAyersMS AndyAyersMS merged commit d06834b into dotnet:main May 21, 2025
109 checks passed
SimaTian pushed a commit that referenced this pull request May 27, 2025
Update the transformation code to make it easier to reorder the checks
in the future, for example trying to handle in-loop allocation sites.
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.

2 participants