Uh oh!
There was an error while loading. Please reload this page.
Remove 16 unused DEFINE_METHOD identifiers, orphaned methods and classes, and unused metasig signatures - #121650
Conversation
Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: MichalStrehovsky <13110571+MichalStrehovsky@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jkotas
commented
Nov 15, 2025
@copilot Could you please also delete all unused signatures in metasig.h while you are on it? |
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Done in 455d099. All 6 unused signatures in metasig.h have been deleted:
|
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Pull Request Overview
This PR removes dead code from CoreCLR by eliminating 16 unused DEFINE_METHOD identifiers from src/coreclr/vm/corelib.h, along with their corresponding managed method implementations, classes, and metasig signatures that became unreferenced.
- Removes 16 DEFINE_METHOD entries across various classes (CLASS, CRITICAL_HANDLE, TASK_1, RT_TYPE_HANDLE, RUNTIME_HELPERS, ASYNC_HELPERS, TIMER_QUEUE, THREAD_POOL, STUBHELPERS)
- Removes 2 orphaned managed methods and 1 orphaned class from StubHelpers.cs
- Removes 6 unused metasig signatures from metasig.h
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/vm/corelib.h | Removes 16 unused DEFINE_METHOD macro entries that had no references in the native codebase |
| src/coreclr/vm/metasig.h | Removes 6 metasig signature definitions that were only referenced by the removed DEFINE_METHOD entries |
| src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs | Removes 2 managed methods (KeepAliveViaCleanupList, LayoutDestroyNativeInternal) and 1 class (KeepAliveCleanupWorkListElement) that became orphaned after DEFINE_METHOD removal |
pavelsavara
commented
Dec 1, 2025
This PR breaks #120976
Related #121359 (comment) Fix -> #122068 |
Removes 16 unreferenced DEFINE_METHOD identifiers from
src/coreclr/vm/corelib.hthat were identified as unused dead code. Also removes the orphaned managed method implementations, classes, and unused metasig signatures that became unreferenced after the DEFINE_METHOD removal.Removed Identifiers
CLASS
GET_METHOD_BASE-GetMethodBase(RuntimeType, RuntimeMethodHandleInternal)GET_FIELD_INFO-GetFieldInfo(RuntimeType, IRuntimeFieldInfo)CRITICAL_HANDLE
RELEASE_HANDLE-ReleaseHandle()GET_IS_INVALID-get_IsInvalid()DISPOSE_BOOL-Dispose(bool)DISPOSE-Dispose()TASK_1
GET_RESULTONSUCCESS-get_ResultOnSuccess()RT_TYPE_HANDLE
PVOID_CTOR-.ctor(RuntimeType)RUNTIME_HELPERS
GET_TAILCALL_INFO-GetTailCallInfo()ASYNC_HELPERS
UNSAFE_AWAIT_AWAITER_1-UnsafeAwaitAwaiter<T>()TIMER_QUEUE / THREAD_POOL (TARGET_BROWSER only)
TIMER_HANDLER-TimerHandler()BACKGROUND_JOB_HANDLER-BackgroundJobHandler()STUBHELPERS
KEEP_ALIVE_VIA_CLEANUP_LIST-KeepAliveViaCleanupList()FMT_CLASS_UPDATE_NATIVE_INTERNAL-FmtClassUpdateNativeInternal()FMT_CLASS_UPDATE_CLR_INTERNAL-FmtClassUpdateCLRInternal()LAYOUT_DESTROY_NATIVE_INTERNAL-LayoutDestroyNativeInternal()Removed Managed Methods
LayoutDestroyNativeInternalmethod insrc/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs- This managed method implementation was removed as it had no remaining callers after its corresponding DEFINE_METHOD macro was deleted from corelib.h.KeepAliveViaCleanupListmethod insrc/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs- This managed method implementation was removed as it had no remaining callers after its corresponding DEFINE_METHOD macro was deleted from corelib.h.Removed Managed Classes
KeepAliveCleanupWorkListElementclass insrc/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs- This class was orphaned after deleting theKeepAliveViaCleanupListmethod that was its only consumer.Removed Metasig Signatures
The following unused signature definitions were removed from
src/coreclr/vm/metasig.h:SM(RuntimeType_RuntimeMethodHandleInternal_RetMethodBase, ...)SM(RuntimeType_IRuntimeFieldInfo_RetFieldInfo, ...)SM(Obj_PtrByte_RefCleanupWorkListElement_RetVoid, ...)SM(Obj_PtrByte_RetVoid, ...)IM(RuntimeType_RetVoid, ...)SM(RefCleanupWorkListElement_Obj_RetVoid, ...)SZARRAYHELPER Methods - Preserved
All SZARRAYHELPER methods remain unchanged in their original positions to preserve the ordering invariant required for ILLink. The comment in the code states: "The order of methods here has to match order they are implemented on the interfaces in IEnumerable`1". These methods were initially considered for removal but have been kept to maintain compatibility:
ISREADONLY-get_IsReadOnly()COPYTO-CopyTo()INDEXOF-IndexOf()REMOVEAT-RemoveAt()All removed identifiers, methods, classes, and signatures verified to have zero references in the CoreCLR codebase.
This pull request was created as a result of the following prompt from Copilot chat.
This pull request was created as a result of the following prompt from Copilot chat.
This pull request was created as a result of the following prompt from Copilot chat.
This pull request was created as a result of the following prompt from Copilot chat.
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.