Skip to content

Rename delegate fields for consistency#129635

Open
Copilot wants to merge 11 commits into
mainfrom
copilot/rename-delegate-implementations
Open

Rename delegate fields for consistency#129635
Copilot wants to merge 11 commits into
mainfrom
copilot/rename-delegate-implementations

Conversation

Copilot AI commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Renames delegate fields to better reflect their actual semantics across CoreCLR and NativeAOT.

…rameter→_target, _functionPointer→_methodPtr (NAOT)

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 19, 2026 20:06
@jkotas jkotas changed the title Rename delegate fields for clarity: _methodBase→_helperObject (CoreCLR), _firstParameter→_target, _functionPointer→_methodPtr (NAOT) Rename delegate fields for consistency Jun 19, 2026
@jkotas jkotas marked this pull request as ready for review June 19, 2026 20:07
@jkotas jkotas requested a review from MichalStrehovsky as a code owner June 19, 2026 20:07
Copilot AI review requested due to automatic review settings June 19, 2026 20:07
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib
See info in area-owners.md if you want to be subscribed.

@jkotas

jkotas commented Jun 19, 2026

Copy link
Copy Markdown
Member

cc @MichalPetryka

@MichalPetryka

Copy link
Copy Markdown
Contributor

cc @MichalPetryka

Could you review #99200 first? I'm afraid this will cause a bunch of annoying merge conflicts so I'd prefer that merged first if you have no objections.

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.

Pull request overview

This PR renames several delegate backing fields across CoreCLR, NativeAOT, and related tooling to better reflect what those fields actually store, while keeping the underlying layouts/offsets consistent.

Changes:

  • CoreCLR: rename delegate field _methodBase_helperObject and update VM/BCL usage accordingly.
  • NativeAOT: rename _firstParameter_target and _functionPointer_methodPtr, updating delegate implementation logic to use the new names.
  • Tooling: update field-name lookups and layout comments in AOT/JIT-related tools to match the new field names.

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/vm/object.h Renames the native DelegateObject field to _helperObject and updates related setters/offset comment.
src/coreclr/vm/corelib.h Updates CoreLib binder field mapping from _methodBase to _helperObject.
src/coreclr/vm/comdelegate.cpp Updates collectible delegate construction to set _helperObject and refreshes related comments.
src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMethodILEmitter.cs Updates delegate field lookups used by emitted IL to _target / _methodPtr.
src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs Refreshes delegate layout commentary in EE info offsets to match new naming.
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/TypePreinit.cs Updates frozen delegate serialization comments/field naming to _target / _methodPtr.
src/coreclr/System.Private.CoreLib/src/System/MulticastDelegate.CoreCLR.cs Updates CoreCLR delegate implementation to use _helperObject instead of _methodBase.
src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs Renames the CoreCLR delegate helper field and updates usages in equality/method resolution paths.
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Delegate.cs Renames NativeAOT delegate backing fields and updates all internal logic to use _target / _methodPtr.

Comment thread src/coreclr/System.Private.CoreLib/src/System/Delegate.CoreCLR.cs
Comment thread src/coreclr/tools/Common/TypeSystem/IL/Stubs/DelegateMethodILEmitter.cs Outdated
@jkotas

jkotas commented Jun 19, 2026

Copy link
Copy Markdown
Member

Could you review #99200 first?

I have started reviewing it and it is what made me to submit this PR. I do not think the mix and match of different styles and unsafe helpers in that change looks good.

…elds

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested a review from jkotas June 19, 2026 20:24
Comment thread src/coreclr/vm/comdelegate.cpp
Copilot AI review requested due to automatic review settings June 19, 2026 20:34
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Comment thread src/coreclr/vm/comdelegate.cpp Outdated
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 20, 2026 01:00
Comment thread src/coreclr/vm/comdelegate.cpp
Comment thread src/coreclr/vm/comdelegate.cpp

Copilot AI commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

@jkotas I've opened a new pull request, #129645, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 20, 2026 01:41
Copilot AI requested a review from jkotas June 20, 2026 01:42
@jkotas

jkotas commented Jun 20, 2026

Copy link
Copy Markdown
Member

@MichalStrehovsky PTLA. No functional changes.

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot June 20, 2026 01:46
Copilot AI requested a review from jkotas June 20, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants