Skip to content

Migrate CordbModule caches to SHash - #132264

Draft
hoyosjs wants to merge 1 commit into
mainfrom
juhoyosa/improve-dbi-hash-tables
Draft

Migrate CordbModule caches to SHash#132264
hoyosjs wants to merge 1 commit into
mainfrom
juhoyosa/improve-dbi-hash-tables

Conversation

@hoyosjs

@hoyosjs hoyosjs commented Aug 13, 2026

Copy link
Copy Markdown
Member

Part of #11466.

CordbSafeHashTable uses a fixed bucket count, causing lookups to degrade as debugger caches grow. This migrates the high-cardinality, non-enumerated CordbModule class, function, and native-code caches to an SHash-backed table.

The new table preserves internal reference ownership, process-lock assertions, lazy allocation, function-version replacement, and linear-time cleanup. It also hashes the full pointer width on 64-bit hosts.

COM-enumerated and EE/DAC tables remain unchanged because they depend on cursor, iteration, or storage-layout behavior that requires separate work.

There are no intended breaking changes.

Note

This pull request description was generated with GitHub Copilot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: be313a78-7324-43ea-9fdb-df0e0bd028b8
Copilot AI lite review requested due to automatic review settings August 13, 2026 06:32
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag
See info in area-owners.md if you want to be subscribed.

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 introduces an SHash-backed hashtable wrapper for right-side debugger (Cordb*) caches and migrates CordbModule’s class/function/native-code caches from the fixed-bucket CordbSafeHashTable to the new CordbSHashTable, keeping the existing internal-ref ownership and RS lock assertions.

Changes:

  • Generalize RSInitHolder::TransferOwnershipToHash to work with multiple hashtable types (not just CordbSafeHashTable).
  • Add CordbSHashTable + CordbSHashTraits (pointer-element SHash wrapper) with 64-bit key hashing that incorporates the high 32 bits.
  • Switch CordbModule’s m_classes, m_functions, and m_nativeCodeTable to CordbSHashTable and remove the old fixed bucket-count ctor initialization.

Reviewed changes

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

File Description
src/coreclr/debug/di/rspriv.h Adds CordbSHashTable wrapper/traits and updates CordbModule cache member types; makes TransferOwnershipToHash generic.
src/coreclr/debug/di/module.cpp Adjusts CordbModule constructor initialization to match the new cache types (default-constructed tables) while preserving debug lock wiring and existing call patterns.

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.

2 participants