Skip to content

Clean up dynamic method desc native stack arg tracking#126585

Merged
jkoritzinsky merged 7 commits intodotnet:mainfrom
jkoritzinsky:cleanup-native-stack-arg-size
Apr 25, 2026
Merged

Clean up dynamic method desc native stack arg tracking#126585
jkoritzinsky merged 7 commits intodotnet:mainfrom
jkoritzinsky:cleanup-native-stack-arg-size

Conversation

@jkoritzinsky
Copy link
Copy Markdown
Member

It's only needed on x86 now and we don't need to track it quite as heavily as we have been.

Addresses concerns in #126509 (comment)

It's only needed on x86 now and we don't need to track it quite as heavily as we have been.
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
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 narrows native stack-argument-size tracking for dynamic/IL stubs to x86-only, reducing bookkeeping now that the behavior is only required on that architecture (per follow-up concerns from #126509).

Changes:

  • Remove the FEATURE_DYNAMIC_METHOD_HAS_NATIVE_STACK_ARG_SIZE indirection and gate related APIs/fields directly on TARGET_X86.
  • Restrict DynamicMethodDesc::Get/SetNativeStackArgSize and MethodDesc::SizeOfNativeArgStack usage to x86 call paths.
  • Simplify some interop stub sites by removing now-unneeded native stack arg size propagation.

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/vm/method.hpp Gates native stack arg size APIs for MethodDesc/DynamicMethodDesc to x86 only.
src/coreclr/vm/method.cpp Gates MethodDesc::SizeOfNativeArgStack() implementation to x86 only.
src/coreclr/vm/dllimport.cpp Updates IL stub signature swap and stub generation paths to only store/copy native stack sizes on x86.
src/coreclr/vm/comtoclrcall.h Refactors ComCallMethodDesc x86-only stack-pop tracking fields/accessor.
src/coreclr/vm/comtoclrcall.cpp Updates COM-to-CLR stub creation to use x86-only native stack arg size tracking.
src/coreclr/vm/clrtocomcall.cpp Removes explicit native stack arg size seeding for certain COM stubs.

Comment thread src/coreclr/vm/comtoclrcall.h
Comment thread src/coreclr/vm/dllimport.cpp Outdated
Comment thread src/coreclr/vm/comtoclrcall.cpp Outdated
Comment thread src/coreclr/vm/dllimport.cpp Outdated
Copilot AI review requested due to automatic review settings April 6, 2026 20:55
@jkoritzinsky jkoritzinsky enabled auto-merge (squash) April 6, 2026 20:56
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jkotas jkotas changed the title Clean up dyanmic method desc native stack arg tracking Clean up dynamic method desc native stack arg tracking Apr 7, 2026
@jkoritzinsky
Copy link
Copy Markdown
Member Author

/azp run runtime,runtime-dev-innerloop,dotnet-linker-tests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Apr 16, 2026

The failure looks related

Assert failure(PID 832 [0x00000340], Thread: 4520 [0x11a8]): HasMarshalError() || !pStubMD->IsILStub() || pStubMD->AsDynamicMethodDesc()->GetNativeStackArgSize() == m_StackBytes

Copilot AI review requested due to automatic review settings April 23, 2026 19:06
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

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

Comment thread src/coreclr/vm/dllimport.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 23, 2026 20:01
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

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

Comment thread src/coreclr/vm/dllimport.cpp
@jkoritzinsky jkoritzinsky merged commit 5d7eea2 into dotnet:main Apr 25, 2026
109 checks passed
@github-project-automation github-project-automation Bot moved this to Done in AppModel Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants