Skip to content

Delete LOADEDMODULES cache #116126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 31, 2025
Merged

Delete LOADEDMODULES cache #116126

merged 3 commits into from
May 31, 2025

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented May 30, 2025

This cache is not used by the runtime and it is not compiled into debugger (mscordbi). It looks like a left-over from fusion.

This cache is not used by the runtime and it is not compiled into debugger (mscordbi). It looks like a left-over from fusion.
@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 02:45
@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label May 30, 2025
@jkotas jkotas added area-VM-coreclr and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 30, 2025
@jkotas jkotas requested a review from AaronRobinsonMSFT May 30, 2025 02:46
Copy link
Contributor

@Copilot 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 pull request removes the LOADEDMODULES cache and all associated caching logic, as it is no longer used by the runtime or debugger. Key changes include:

  • Eliminating calls to AddToCache across multiple modules and functions.
  • Removing the LOADEDMODULES class and the regmeta_vm.cpp file.
  • Updating RegMeta methods (e.g., Release and ResolveTypeRef) to simplify implementation by removing cache handling.

Reviewed Changes

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

Show a summary per file
File Description
src/coreclr/md/enc/mdinternalrw.cpp Removed AddToCache call as part of deprecating caching logic.
src/coreclr/md/compiler/regmeta_vm.cpp Deleted obsolete file containing LOADEDMODULES cache logic.
src/coreclr/md/compiler/regmeta_import.cpp Updated ResolveTypeRef to return E_NOTIMPL, deprecating cache use.
src/coreclr/md/compiler/regmeta.h Removed declarations for caching methods and members.
src/coreclr/md/compiler/regmeta.cpp Simplified Release implementation, removing cache-related checks.
src/coreclr/md/compiler/mdutil.h Removed LOADEDMODULES class and associated functions.
src/coreclr/md/compiler/emit.cpp Updated DefineSecurityAttributeSet to return E_NOTIMPL.
src/coreclr/md/compiler/disp.cpp Removed multiple AddToCache calls, eliminating cache lookup logic.
src/coreclr/md/compiler/assemblymd.cpp Removed unused code related to caching.
src/coreclr/md/compiler/CMakeLists.txt Removed regmeta_vm.cpp from the build, as it is no longer needed.
Comments suppressed due to low confidence (3)

src/coreclr/md/compiler/disp.cpp:182

  • The removal of the cached RegMeta lookup in the read-only path means that every open call creates a new instance; please confirm that this change does not adversely impact performance or memory usage.
if (IsOfReadOnly(dwOpenFlags) && IsOfReadWrite(dwOpenFlags)) {   // Invalid combination of flags - ofReadOnly & ofWrite

src/coreclr/md/compiler/regmeta.cpp:524

  • The updated Release method now simply deletes the instance when the reference count reaches zero. Please verify that all concurrent usage scenarios have been adjusted to account for the removal of cache-specific lifetime management.
ULONG RegMeta::Release() { ULONG cRef = InterlockedDecrement(&m_cRef);

src/coreclr/md/compiler/regmeta_import.cpp:831

  • Since ResolveTypeRef now returns E_NOTIMPL, please ensure that clients calling this API have been updated to handle this deprecation appropriately.
return E_NOTIMPL;

Copy link
Contributor

Tagging subscribers to this area: @mangod9
See info in area-owners.md if you want to be subscribed.

@huoyaoyuan
Copy link
Member

The caching logic for CLiteWeightStgdbRW::m_dwDatabaseLFT/m_dwDatabaseLFS in CLiteWeightStgdbRW::OpenForRead can also be removed. However, I'm unsure whether the copy logic at Target_CLiteWeightStgdbRW::ReadFrom has impact.

Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@AaronRobinsonMSFT
Copy link
Member

@jkotas Do you know what FEATURE_METADATA_IN_VM is intended for?

@jkotas
Copy link
Member Author

jkotas commented May 30, 2025

Do you know what FEATURE_METADATA_IN_VM is intended for?

IMetadata... interface implementations are compiled into multiple binaries, with different features. The flavor compiled into coreclr.dll has one set of features, the flavor compiled into mscordbi.dll has different set of features. We used to have even more flavors in .NET Framework.

FEATURE_METADATA_IN_VM controls features of the coreclr.dll flavor. The only feature left after this cleanup is a free threaded marshaller . I am thinking we can delete it too.

The only feature left was a free-threaded marshaller that should not be needed for the limited use of IMetadata interface by profilers.
@jkotas jkotas merged commit 7a06f23 into dotnet:main May 31, 2025
91 of 94 checks passed
@jkotas jkotas deleted the LOADEDMODULES branch May 31, 2025 00:27
jkotas added a commit to jkotas/runtime that referenced this pull request Jun 6, 2025
jkotas added a commit that referenced this pull request Jun 7, 2025
…116374)

* Revert "Delete LOADEDMODULES cache (#116126)"

This reverts commit 7a06f23.

* Revert caching by file name path

* Additional cleanup
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