Skip to content

Commit e9957dc

Browse files
authored
Partial revert of "Delete LOADEDMODULES cache", additional cleanup (#116374)
* Revert "Delete LOADEDMODULES cache (#116126)" This reverts commit 7a06f23. * Revert caching by file name path * Additional cleanup
1 parent aad452c commit e9957dc

31 files changed

+593
-576
lines changed

src/coreclr/debug/di/process.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@ HRESULT CordbProcess::Init()
17401740
hr = m_pDACDataTarget->QueryInterface(IID_ICorDebugMetaDataLocator, reinterpret_cast<void **>(&m_pMetaDataLocator));
17411741

17421742
// Get the metadata dispenser.
1743-
hr = InternalCreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&m_pMetaDispenser);
1743+
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&m_pMetaDispenser);
17441744

17451745
// We statically link in the dispenser. We expect it to succeed, except for OOM, which
17461746
// debugger doesn't yet handle.

src/coreclr/dlls/mscoree/mscoree.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,10 @@ STDAPI DLLEXPORT MetaDataGetDispenser( // Return HRESULT
6464
PRECONDITION(CheckPointer(ppv));
6565
} CONTRACTL_END;
6666

67-
NonVMComHolder<IClassFactory> pcf(NULL);
68-
HRESULT hr;
67+
if (rclsid != CLSID_CorMetaDataDispenser)
68+
return CLASS_E_CLASSNOTAVAILABLE;
6969

70-
IfFailGo(MetaDataDllGetClassObject(rclsid, IID_IClassFactory, (void **) &pcf));
71-
hr = pcf->CreateInstance(NULL, riid, ppv);
72-
73-
ErrExit:
74-
return (hr);
70+
return CreateMetaDataDispenser(riid, ppv);
7571
}
7672

7773
// ---------------------------------------------------------------------------

src/coreclr/ilasm/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ set(ILASM_LINK_LIBRARIES
8787
mdcompiler_ppdb
8888
mdruntime_ppdb
8989
mdruntimerw_ppdb
90-
mdstaticapi_ppdb
9190
${END_LIBRARY_GROUP} # End group of libraries that have circular references
9291
ceefgen
9392
corguids

src/coreclr/ilasm/writer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include "ceefilegenwriter.h"
1212
#include "sha256.h"
1313

14+
#include "metadataexports.h"
15+
1416
#ifndef _MSC_VER
1517
//cloned definition from ntimage.h that is removed for non MSVC builds
1618
typedef VOID
@@ -30,8 +32,7 @@ HRESULT Assembler::InitMetaData()
3032

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

33-
hr = MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
34-
IID_IMetaDataDispenserEx2, (void **)&m_pDisp);
35+
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx2, (void **)&m_pDisp);
3536
if (FAILED(hr))
3637
goto exit;
3738

src/coreclr/ildasm/dasm.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <metamodelpub.h>
1313
#include "formattype.h"
1414
#include "readytorun.h"
15+
#include "metadataexports.h"
1516

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

1572-
if (FAILED(GetMetaDataInternalInterfaceFromPublic(
1573+
if (FAILED(GetMDInternalInterfaceFromPublic(
15731574
pUnk,
15741575
IID_IMDInternalImport,
15751576
(LPVOID *)ppIMDInew)))
@@ -6933,8 +6934,7 @@ void DumpMetaInfo(_In_ __nullterminated const WCHAR* pwzFileName, _In_opt_z_ con
69336934
if(pch && (!_wcsicmp(pch+1,W("lib")) || !_wcsicmp(pch+1,W("obj"))))
69346935
{ // This works only when all the rest does not
69356936
// Init and run.
6936-
if (SUCCEEDED(MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
6937-
IID_IMetaDataDispenserEx, (void **)&g_pDisp)))
6937+
if (SUCCEEDED(CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&g_pDisp)))
69386938
{
69396939
WCHAR *pwzObjFileName=NULL;
69406940
if (pszObjFileName)
@@ -6955,8 +6955,7 @@ void DumpMetaInfo(_In_ __nullterminated const WCHAR* pwzFileName, _In_opt_z_ con
69556955
HRESULT hr = S_OK;
69566956
if(g_pDisp == NULL)
69576957
{
6958-
hr = MetaDataGetDispenser(CLSID_CorMetaDataDispenser,
6959-
IID_IMetaDataDispenserEx, (void **)&g_pDisp);
6958+
hr = CreateMetaDataDispenser(IID_IMetaDataDispenserEx, (void **)&g_pDisp);
69606959
}
69616960
if(SUCCEEDED(hr))
69626961
{
@@ -7464,7 +7463,7 @@ BOOL DumpFile()
74647463
g_cbMetaData = VAL32(g_CORHeader->MetaData.Size);
74657464
}
74667465

7467-
if (FAILED(GetMetaDataInternalInterface(
7466+
if (FAILED(GetMDInternalInterface(
74687467
(BYTE *)g_pMetaData,
74697468
g_cbMetaData,
74707469
openFlags,
@@ -7478,7 +7477,7 @@ BOOL DumpFile()
74787477
}
74797478

74807479
TokenSigInit(g_pImport);
7481-
if (FAILED(MetaDataGetDispenser(CLSID_CorMetaDataDispenser, IID_IMetaDataDispenser, (LPVOID*)&pMetaDataDispenser)))
7480+
if (FAILED(CreateMetaDataDispenser(IID_IMetaDataDispenser, (LPVOID*)&pMetaDataDispenser)))
74827481
{
74837482
if (g_fDumpHeader)
74847483
DumpHeader(g_CORHeader, g_pFile);

src/coreclr/ildasm/dman.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "dynamicarray.h"
1717
#include "resource.h"
1818

19-
#include "clrinternal.h"
19+
#include "metadataexports.h"
2020

2121
#ifndef MAX_LOCALE_NAME
2222
#define MAX_LOCALE_NAME (32)
@@ -987,14 +987,14 @@ IMetaDataAssemblyImport* GetAssemblyImport(void* GUICookie)
987987
if(pdwSize && *pdwSize)
988988
{
989989
pbManifest += sizeof(DWORD);
990-
if (SUCCEEDED(hr = GetMetaDataInternalInterface(
990+
if (SUCCEEDED(hr = GetMDInternalInterface(
991991
pbManifest,
992992
VAL32(*pdwSize),
993993
ofRead,
994994
IID_IMDInternalImport,
995995
(LPVOID *)&pParam->pImport)))
996996
{
997-
if (FAILED(hr = GetMetaDataPublicInterfaceFromInternal(
997+
if (FAILED(hr = GetMDPublicInterfaceFromInternal(
998998
pParam->pImport,
999999
IID_IMetaDataAssemblyImport,
10001000
(LPVOID *)&pParam->pAssemblyImport)))

src/coreclr/ildasm/exe/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ set(ILDASM_LINK_LIBRARIES
6969
mdcompiler_wks
7070
mdruntime_wks
7171
mdruntimerw_wks
72-
mdstaticapi
7372
${END_LIBRARY_GROUP} # End group of libraries that have circular references
7473
corguids
7574
)

src/coreclr/inc/corpriv.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,13 @@
77

88
#ifndef _CORPRIV_H_
99
#define _CORPRIV_H_
10-
#if _MSC_VER >= 1000
11-
#pragma once
12-
#endif // _MSC_VER >= 1000
1310

14-
// %%Includes: ---------------------------------------------------------------
15-
// avoid taking DLL import hit on intra-DLL calls
16-
#define NODLLIMPORT
1711
#include <daccess.h>
1812
#include "cor.h"
1913
#include "corimage.h"
2014
#include "metadata.h"
2115
#include <sstring.h>
22-
//
2316

24-
interface IAssemblyName;
2517

2618
class UTSemReadWrite;
2719

@@ -83,32 +75,6 @@ enum MDInternalImportFlags
8375

8476

8577

86-
STDAPI GetAssemblyMDInternalImportEx( // Return code.
87-
LPCWSTR szFileName, // [IN] The scope to open.
88-
REFIID riid, // [IN] The interface desired.
89-
MDInternalImportFlags flags, // [in] Flags to control opening the assembly
90-
IUnknown **ppIUnk, // [OUT] Return interface on success.
91-
HANDLE hFile = INVALID_HANDLE_VALUE);
92-
93-
STDAPI GetAssemblyMDInternalImportByStreamEx( // Return code.
94-
IStream *pIStream, // [IN] The IStream for the file
95-
UINT64 AssemblyId, // [IN] Unique Id for the assembly
96-
REFIID riid, // [IN] The interface desired.
97-
MDInternalImportFlags flags, // [in] Flags to control opening the assembly
98-
IUnknown **ppIUnk); // [OUT] Return interface on success.
99-
100-
101-
// Returns part of the "Zap string" which describes the properties of a native image
102-
103-
__success(SUCCEEDED(return))
104-
STDAPI GetNativeImageDescription(
105-
_In_z_ LPCWSTR wzCustomString, // [IN] Custom string of the native image
106-
DWORD dwConfigMask, // [IN] Config mask of the native image
107-
_Out_writes_to_opt_(*pdwLength,*pdwLength) LPWSTR pwzZapInfo,// [OUT] The description string. Can be NULL to find the size of buffer to allocate
108-
LPDWORD pdwLength); // [IN/OUT] Length of the pwzZapInfo buffer on IN.
109-
// Number of WCHARs (including termintating NULL) on OUT
110-
111-
11278
class CQuickBytes;
11379

11480

src/coreclr/inc/metadataexports.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@
1717

1818

1919

20-
// General creation function for ClassFactory semantics.
21-
STDAPI MetaDataDllGetClassObject(REFCLSID rclsid, REFIID riid, void ** ppv);
22-
2320
// Specific creation function to get IMetaDataDispenser(Ex) interface.
24-
HRESULT InternalCreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut);
21+
HRESULT CreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut);
2522

2623
STDAPI GetMDInternalInterface(
2724
LPVOID pData,

src/coreclr/md/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
add_compile_definitions(FEATURE_METADATA_EMIT)
22
add_compile_definitions(FEATURE_METADATA_INTERNAL_APIS)
33
add_compile_definitions($<$<OR:$<BOOL:$<TARGET_PROPERTY:DAC_COMPONENT>>,$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>>:FEATURE_METADATA_EMIT_IN_DEBUGGER>)
4+
add_compile_definitions($<$<NOT:$<OR:$<BOOL:$<TARGET_PROPERTY:DAC_COMPONENT>>,$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>>>:FEATURE_METADATA_IN_VM>)
45
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_CUSTOM_DATA_SOURCE>)
56
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_DEBUGGEE_DATA_SOURCE>)
67
add_compile_definitions($<$<BOOL:$<TARGET_PROPERTY:DBI_COMPONENT>>:FEATURE_METADATA_LOAD_TRUSTED_IMAGES>)
@@ -16,4 +17,3 @@ add_subdirectory(runtime)
1617
add_subdirectory(enc)
1718
add_subdirectory(ceefilegen)
1819
add_subdirectory(datasource)
19-
add_subdirectory(staticmd)

src/coreclr/md/compiler/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
set(MDCOMPILER_SOURCES
22
assemblymd.cpp
33
assemblymd_emit.cpp
4-
classfactory.cpp
54
custattr_import.cpp
65
custattr_emit.cpp
76
disp.cpp
@@ -16,6 +15,7 @@ set(MDCOMPILER_SOURCES
1615
regmeta_emit.cpp
1716
regmeta_import.cpp
1817
regmeta_imetadatatables.cpp
18+
regmeta_vm.cpp
1919
)
2020

2121
set(MDCOMPILER_HEADERS
@@ -31,7 +31,6 @@ set(MDCOMPILER_HEADERS
3131
../inc/metamodelrw.h
3232
../inc/rwutil.h
3333
../inc/stgio.h
34-
classfactory.h
3534
custattr.h
3635
disp.h
3736
filtermanager.h

src/coreclr/md/compiler/assemblymd.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ STDMETHODIMP RegMeta::FindManifestResourceByName( // S_OK or error
568568
} // RegMeta::FindManifestResourceByName
569569

570570
//*******************************************************************************
571-
// Used to find assemblies either in Fusion cache or on disk at build time.
571+
// Used to find assemblies either on disk at build time.
572572
//*******************************************************************************
573573
STDMETHODIMP RegMeta::FindAssembliesByName( // S_OK or error
574574
LPCWSTR szAppBase, // [IN] optional - can be NULL

src/coreclr/md/compiler/assemblymd_emit.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
#include "mdlog.h"
1616
#include "importhelper.h"
1717

18-
#ifdef _MSC_VER
19-
#pragma warning(disable: 4102)
20-
#endif
21-
2218
#ifdef FEATURE_METADATA_EMIT
2319

2420
//*******************************************************************************

0 commit comments

Comments
 (0)