Skip to content

JIT: Escape analysis cleanup #114716

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
merged 3 commits into from
Apr 16, 2025
Merged

Conversation

AndyAyersMS
Copy link
Member

Follow up to #113977

  • use printfAlloc in a few places
  • move escape-analysis specific layout code to objectalloc.cpp
  • use custom layout for stack allocated boxes
  • use layout a bit more broadly in objectalloc.cpp

Addresses JIT side of #114204 -- I have not altered the VM or jit interface yet, to allow this PR to be easily diffable.

@Copilot Copilot AI review requested due to automatic review settings April 15, 2025 23:06
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 15, 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.

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

@@ -1449,8 +1444,7 @@ unsigned int ObjectAllocator::MorphNewArrNodeIntoStackAlloc(GenTreeCall*
// allocation.
// Arguments:
// allocObj - GT_ALLOCOBJ that will be replaced by a stack allocation
// clsHnd - class representing the stack allocated object
// isValueClass - we are stack allocating a boxed value class
// layout - layout for the stack allocated objectd
Copy link
Preview

Copilot AI Apr 15, 2025

Choose a reason for hiding this comment

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

Typo in the comment: 'objectd' should be corrected to 'object'.

Suggested change
// layout - layout for the stack allocated objectd
// layout - layout for the stack allocated object

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

@jakobbotsch PTAL
cc @dotnet/jit-contrib

One diff locally. A boxed object had padding that is now properly modelled during promotion, leading to slightly better code.

SPMI misses since we now call getTypeForBox instead of getTypeForBoxOnStack


if (isValueClass)
{
CORINFO_CLASS_HANDLE boxedClsHnd = comp->info.compCompHnd->getTypeForBox(clsHnd);
Copy link
Member

Choose a reason for hiding this comment

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

Is this purely for correct handling of nullables?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

@AndyAyersMS
Copy link
Member Author

Linux x64 failure might be related, let me see if I can repro it.

@AndyAyersMS
Copy link
Member Author

No luck with runfo bits so far. Going to retry CI.

@AndyAyersMS AndyAyersMS merged commit 4ea3cb1 into dotnet:main Apr 16, 2025
110 of 112 checks passed
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