Dead-code cleanup: HandleTableMap multi-bucket / multi-AppDomain scaffolding#128646
Merged
Conversation
…B.1) Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
max-charlamb
May 27, 2026 13:58
View session
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/gc |
3 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes now-unused multi-bucket / multi-AppDomain handle-table scaffolding in CoreCLR’s GC handle table implementation and replaces legacy, effectively-unreachable ABI surface with assert-based stubs to preserve vtable layout.
Changes:
- Removes
Ref_InitializeHandleTableBucket(declaration + definition) since it no longer has in-tree callers. - Replaces
GCHandleStore::Uproot,GCHandleStore::ContainsHandle, andGCHandleManager::CreateHandleStoreimplementations with assert stubs (while keeping the vtable slots) and returns safe defaults (false/nullptr). - Simplifies
CreateHandleStoreby removing theFEATURE_NATIVEAOTsplit in favor of a single stub.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/gc/objecthandle.h | Removes the unused Ref_InitializeHandleTableBucket declaration. |
| src/coreclr/gc/objecthandle.cpp | Removes the unused Ref_InitializeHandleTableBucket implementation. |
| src/coreclr/gc/gchandletable.cpp | Stubs out legacy virtual methods with asserts to keep ABI/vtable shape while making the path loudly unreachable in checked/debug builds. |
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
max-charlamb
left a comment
Member
There was a problem hiding this comment.
@copilot , please address
Co-authored-by: max-charlamb <44248479+max-charlamb@users.noreply.github.com>
Contributor
Author
max-charlamb
approved these changes
May 27, 2026
Member
|
/ba-g All test failures are known issues or caused by Helix issues on amd64 osx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since
dotnet/coreclr#23588(April 2019) removed AppDomain-per-process support,g_HandleTableMaphas had exactly one node andCreateHandleStorehas had zero callers. The supporting scaffolding was never cleaned up.Changes
Tier B.1 — ABI-preserving stubs (
gchandletable.cpp)GCHandleStore::Uproot,GCHandleStore::ContainsHandle,GCHandleManager::CreateHandleStorebodies replaced withassert(!"…dead path…"). Vtable slots preserved forGC_INTERFACE_MAJOR_VERSION 5ABI compatibility with external standalone GC implementations. The#ifndef FEATURE_NATIVEAOTsplit inCreateHandleStoreis unified into a single stub.Tier A — internal removal (
objecthandle.cpp,objecthandle.h)Ref_InitializeHandleTableBucketremoved (definition + header declaration); its only caller wasCreateHandleStore.HandleTableBucketHolderis retained — still used byRef_Initialize.Net ~90 lines removed, no behavior change. The assert stubs convert previously silent dead code into loud regression detection.