Skip to content

Partial revert of "Delete LOADEDMODULES cache", additional cleanup #116374

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
Jun 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/coreclr/debug/di/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ HRESULT CordbProcess::Init()
hr = m_pDACDataTarget->QueryInterface(IID_ICorDebugMetaDataLocator, reinterpret_cast<void **>(&m_pMetaDataLocator));

// Get the metadata dispenser.
hr = InternalCreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&m_pMetaDispenser);
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&m_pMetaDispenser);

// We statically link in the dispenser. We expect it to succeed, except for OOM, which
// debugger doesn't yet handle.
Expand Down
10 changes: 3 additions & 7 deletions src/coreclr/dlls/mscoree/mscoree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,10 @@ STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT
PRECONDITION(CheckPointer(ppv));
} CONTRACTL_END;

NonVMComHolder<IClassFactory> pcf(NULL);
HRESULT hr;
if (rclsid != CLSID_CorMetaDataDispenser)
return CLASS_E_CLASSNOTAVAILABLE;

IfFailGo(MetaDataDllGetClassObject(rclsid, IID_IClassFactory, (void **) &pcf));
hr = pcf->CreateInstance(NULL, riid, ppv);

ErrExit:
return (hr);
return CreateMetaDataDispenser(riid, ppv);
}

// ---------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/ilasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ set(ILASM_LINK_LIBRARIES
mdcompiler_ppdb
mdruntime_ppdb
mdruntimerw_ppdb
mdstaticapi_ppdb
${END_LIBRARY_GROUP} # End group of libraries that have circular references
ceefgen
corguids
Expand Down
5 changes: 3 additions & 2 deletions src/coreclr/ilasm/writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include "ceefilegenwriter.h"
#include "sha256.h"

#include "metadataexports.h"

#ifndef _MSC_VER
//cloned definition from ntimage.h that is removed for non MSVC builds
typedef VOID
Expand All @@ -30,8 +32,7 @@ HRESULT Assembler::InitMetaData()

if(bClock) bClock->cMDInitBegin = minipal_lowres_ticks();

hr = MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
IID_IMetaDataDispenserEx2, (void **)&m_pDisp);
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx2, (void **)&m_pDisp);
if (FAILED(hr))
goto exit;

Expand Down
13 changes: 6 additions & 7 deletions src/coreclr/ildasm/dasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <metamodelpub.h>
#include "formattype.h"
#include "readytorun.h"
#include "metadataexports.h"

#define DECLARE_DATA
#include "dasmenum.hpp"
Expand Down Expand Up @@ -1569,7 +1570,7 @@ mdToken TypeRefToTypeDef(mdToken tk, IMDInternalImport *pIMDI, IMDInternalImport
IUnknown *pUnk;
if(FAILED(pIAMDI[0]->QueryInterface(IID_IUnknown, (void**)&pUnk))) goto AssignAndReturn;

if (FAILED(GetMetaDataInternalInterfaceFromPublic(
if (FAILED(GetMDInternalInterfaceFromPublic(
pUnk,
IID_IMDInternalImport,
(LPVOID *)ppIMDInew)))
Expand Down Expand Up @@ -6933,8 +6934,7 @@ void DumpMetaInfo(_In_ __nullterminated const WCHAR* pwzFileName, _In_opt_z_ con
if(pch && (!_wcsicmp(pch+1,W("lib")) || !_wcsicmp(pch+1,W("obj"))))
{ // This works only when all the rest does not
// Init and run.
if (SUCCEEDED(MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
IID_IMetaDataDispenserEx, (void **)&g_pDisp)))
if (SUCCEEDED(CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&g_pDisp)))
{
WCHAR *pwzObjFileName=NULL;
if (pszObjFileName)
Expand All @@ -6955,8 +6955,7 @@ void DumpMetaInfo(_In_ __nullterminated const WCHAR* pwzFileName, _In_opt_z_ con
HRESULT hr = S_OK;
if(g_pDisp == NULL)
{
hr = MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
IID_IMetaDataDispenserEx, (void **)&g_pDisp);
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&g_pDisp);
}
if(SUCCEEDED(hr))
{
Expand Down Expand Up @@ -7464,7 +7463,7 @@ BOOL DumpFile()
g_cbMetaData = VAL32(g_CORHeader->MetaData.Size);
}

if (FAILED(GetMetaDataInternalInterface(
if (FAILED(GetMDInternalInterface(
(BYTE *)g_pMetaData,
g_cbMetaData,
openFlags,
Expand All @@ -7478,7 +7477,7 @@ BOOL DumpFile()
}

TokenSigInit(g_pImport);
if (FAILED(MetaDataGetDispenser(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenser, (LPVOID*)&pMetaDataDispenser)))
if (FAILED(CreateMetaDataDispenser(IID_IMetaDataDispenser, (LPVOID*)&pMetaDataDispenser)))
{
if (g_fDumpHeader)
DumpHeader(g_CORHeader, g_pFile);
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/ildasm/dman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "dynamicarray.h"
#include "resource.h"

#include "clrinternal.h"
#include "metadataexports.h"

#ifndef MAX_LOCALE_NAME
#define MAX_LOCALE_NAME (32)
Expand Down Expand Up @@ -987,14 +987,14 @@ IMetaDataAssemblyImport* GetAssemblyImport(void* GUICookie)
if(pdwSize && *pdwSize)
{
pbManifest += sizeof(DWORD);
if (SUCCEEDED(hr = GetMetaDataInternalInterface(
if (SUCCEEDED(hr = GetMDInternalInterface(
pbManifest,
VAL32(*pdwSize),
ofRead,
IID_IMDInternalImport,
(LPVOID *)&pParam->pImport)))
{
if (FAILED(hr = GetMetaDataPublicInterfaceFromInternal(
if (FAILED(hr = GetMDPublicInterfaceFromInternal(
pParam->pImport,
IID_IMetaDataAssemblyImport,
(LPVOID *)&pParam->pAssemblyImport)))
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/ildasm/exe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ set(ILDASM_LINK_LIBRARIES
mdcompiler_wks
mdruntime_wks
mdruntimerw_wks
mdstaticapi
${END_LIBRARY_GROUP} # End group of libraries that have circular references
corguids
)
Expand Down
34 changes: 0 additions & 34 deletions src/coreclr/inc/corpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@

#ifndef _CORPRIV_H_
#define _CORPRIV_H_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000

// %%Includes: ---------------------------------------------------------------
// avoid taking DLL import hit on intra-DLL calls
#define NODLLIMPORT
#include <daccess.h>
#include "cor.h"
#include "corimage.h"
#include "metadata.h"
#include <sstring.h>
//

interface IAssemblyName;

class UTSemReadWrite;

Expand Down Expand Up @@ -83,32 +75,6 @@ enum MDInternalImportFlags



STDAPI GetAssemblyMDInternalImportEx( // Return code.
LPCWSTR szFileName, // [IN] The scope to open.
REFIID riid, // [IN] The interface desired.
MDInternalImportFlags flags, // [in] Flags to control opening the assembly
IUnknown **ppIUnk, // [OUT] Return interface on success.
HANDLE hFile = INVALID_HANDLE_VALUE);

STDAPI GetAssemblyMDInternalImportByStreamEx( // Return code.
IStream *pIStream, // [IN] The IStream for the file
UINT64 AssemblyId, // [IN] Unique Id for the assembly
REFIID riid, // [IN] The interface desired.
MDInternalImportFlags flags, // [in] Flags to control opening the assembly
IUnknown **ppIUnk); // [OUT] Return interface on success.


// Returns part of the "Zap string" which describes the properties of a native image

__success(SUCCEEDED(return))
STDAPI GetNativeImageDescription(
_In_z_ LPCWSTR wzCustomString, // [IN] Custom string of the native image
DWORD dwConfigMask, // [IN] Config mask of the native image
_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR pwzZapInfo,// [OUT] The description string. Can be NULL to find the size of buffer to allocate
LPDWORD pdwLength); // [IN/OUT] Length of the pwzZapInfo buffer on IN.
// Number of WCHARs (including termintating NULL) on OUT


class CQuickBytes;


Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/inc/metadataexports.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@



// General creation function for ClassFactory semantics.
STDAPI MetaDataDllGetClassObject(REFCLSID rclsid, REFIID riid, void ** ppv);

// Specific creation function to get IMetaDataDispenser(Ex) interface.
HRESULT InternalCreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut);
HRESULT CreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut);

STDAPI GetMDInternalInterface(
LPVOID pData,
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
add_compile_definitions(FEATURE_METADATA_EMIT)
add_compile_definitions(FEATURE_METADATA_INTERNAL_APIS)
add_compile_definitions($<$<OR:$<BOOL:$<TARGET_PROPERTY:DAC_COMPONENT>>,$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>>:FEATURE_METADATA_EMIT_IN_DEBUGGER>)
add_compile_definitions($<$<NOT:$<OR:$<BOOL:$<TARGET_PROPERTY:DAC_COMPONENT>>,$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>>>:FEATURE_METADATA_IN_VM>)
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_CUSTOM_DATA_SOURCE>)
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_DEBUGGEE_DATA_SOURCE>)
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_LOAD_TRUSTED_IMAGES>)
Expand All @@ -16,4 +17,3 @@ add_subdirectory(runtime)
add_subdirectory(enc)
add_subdirectory(ceefilegen)
add_subdirectory(datasource)
add_subdirectory(staticmd)
3 changes: 1 addition & 2 deletions src/coreclr/md/compiler/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
set(MDCOMPILER_SOURCES
assemblymd.cpp
assemblymd_emit.cpp
classfactory.cpp
custattr_import.cpp
custattr_emit.cpp
disp.cpp
Expand All @@ -16,6 +15,7 @@ set(MDCOMPILER_SOURCES
regmeta_emit.cpp
regmeta_import.cpp
regmeta_imetadatatables.cpp
regmeta_vm.cpp
)

set(MDCOMPILER_HEADERS
Expand All @@ -31,7 +31,6 @@ set(MDCOMPILER_HEADERS
../inc/metamodelrw.h
../inc/rwutil.h
../inc/stgio.h
classfactory.h
custattr.h
disp.h
filtermanager.h
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/md/compiler/assemblymd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ STDMETHODIMP RegMeta::FindManifestResourceByName( // S_OK or error
} // RegMeta::FindManifestResourceByName

//*******************************************************************************
// Used to find assemblies either in Fusion cache or on disk at build time.
// Used to find assemblies either on disk at build time.
//*******************************************************************************
STDMETHODIMP RegMeta::FindAssembliesByName( // S_OK or error
LPCWSTR szAppBase, // [IN] optional - can be NULL
Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/md/compiler/assemblymd_emit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
#include "mdlog.h"
#include "importhelper.h"

#ifdef _MSC_VER
#pragma warning(disable: 4102)
#endif

#ifdef FEATURE_METADATA_EMIT

//*******************************************************************************
Expand Down
Loading
Loading