Skip to content

Commit f6b344b

Browse files
authored
Remove IAssemblyName (and various fusion remnants) (#50755)
1 parent 52f9867 commit f6b344b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+552
-2357
lines changed

src/coreclr/binder/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ set(BINDER_COMMON_SOURCES
1313
clrprivbindercoreclr.cpp
1414
coreclrbindercommon.cpp
1515
failurecache.cpp
16-
fusionassemblyname.cpp
1716
stringlexer.cpp
1817
textualidentityparser.cpp
1918
utils.cpp
20-
variables.cpp
2119
)
2220

2321
set(BINDER_COMMON_HEADERS
@@ -42,15 +40,12 @@ set(BINDER_COMMON_HEADERS
4240
inc/coreclrbindercommon.h
4341
inc/failurecache.hpp
4442
inc/failurecachehashtraits.hpp
45-
inc/fusionassemblyname.hpp
46-
inc/fusionhelpers.hpp
4743
inc/loadcontext.hpp
4844
inc/loadcontext.inl
4945
inc/stringlexer.hpp
5046
inc/stringlexer.inl
5147
inc/textualidentityparser.hpp
5248
inc/utils.hpp
53-
inc/variables.hpp
5449
)
5550

5651
set(BINDER_SOURCES

src/coreclr/binder/applicationcontext.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "failurecache.hpp"
1818
#include "assemblyidentitycache.hpp"
1919
#include "utils.hpp"
20-
#include "variables.hpp"
2120
#include "ex.h"
2221
#include "clr/fs/path.h"
2322
using namespace clr::fs;

src/coreclr/binder/assembly.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ namespace BINDER_SPACE
182182
return (pAsmName == nullptr ? nullptr : (LPCWSTR)pAsmName->GetSimpleName());
183183
}
184184

185-
HRESULT Assembly::BindAssemblyByName(IAssemblyName * pIAssemblyName, ICLRPrivAssembly ** ppAssembly)
185+
HRESULT Assembly::BindAssemblyByName(AssemblyNameData *pAssemblyNameData, ICLRPrivAssembly ** ppAssembly)
186186
{
187-
return (m_pBinder == NULL) ? E_FAIL : m_pBinder->BindAssemblyByName(pIAssemblyName, ppAssembly);
187+
return (m_pBinder == NULL) ? E_FAIL : m_pBinder->BindAssemblyByName(pAssemblyNameData, ppAssembly);
188188
}
189189

190190
HRESULT Assembly::GetBinderID(UINT_PTR *pBinderId)

src/coreclr/binder/assemblybinder.cpp

Lines changed: 14 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,20 @@
2020
#include "bindresult.inl"
2121
#include "failurecache.hpp"
2222
#include "utils.hpp"
23-
#include "variables.hpp"
2423
#include "stringarraylist.h"
2524
#include "configuration.h"
2625

27-
#define APP_DOMAIN_LOCKED_UNLOCKED 0x02
28-
#define APP_DOMAIN_LOCKED_CONTEXT 0x04
29-
3026
#ifndef IMAGE_FILE_MACHINE_ARM64
3127
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
3228
#endif
3329

34-
BOOL IsCompilationProcess();
35-
3630
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
3731
#include "clrprivbindercoreclr.h"
38-
#include "clrprivbinderassemblyloadcontext.h"
3932
// Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver
4033
extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin,
41-
IAssemblyName *pIAssemblyName, CLRPrivBinderCoreCLR *pTPABinder,
42-
BINDER_SPACE::AssemblyName *pAssemblyName, ICLRPrivAssembly **ppLoadedAssembly);
34+
BINDER_SPACE::AssemblyName *pAssemblyName,
35+
CLRPrivBinderCoreCLR *pTPABinder,
36+
ICLRPrivAssembly **ppLoadedAssembly);
4337

4438
#endif // !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
4539

@@ -112,12 +106,13 @@ namespace BINDER_SPACE
112106
return true;
113107
}
114108

109+
const WCHAR* s_httpURLPrefix = W("http://");
115110
HRESULT URLToFullPath(PathString &assemblyPath)
116111
{
117112
HRESULT hr = S_OK;
118113

119114
SString::Iterator pos = assemblyPath.Begin();
120-
if (assemblyPath.MatchCaseInsensitive(pos, g_BinderVariables->httpURLPrefix))
115+
if (assemblyPath.MatchCaseInsensitive(pos, s_httpURLPrefix))
121116
{
122117
// HTTP downloads are unsupported
123118
hr = FUSION_E_CODE_DOWNLOAD_DISABLED;
@@ -186,23 +181,6 @@ namespace BINDER_SPACE
186181
#endif // !CROSSGEN_COMPILE
187182
};
188183

189-
/* static */
190-
HRESULT AssemblyBinder::Startup()
191-
{
192-
STATIC_CONTRACT_NOTHROW;
193-
194-
HRESULT hr = S_OK;
195-
196-
// This should only be called once
197-
_ASSERTE(g_BinderVariables == NULL);
198-
g_BinderVariables = new Variables();
199-
IF_FAIL_GO(g_BinderVariables->Init());
200-
201-
Exit:
202-
return hr;
203-
}
204-
205-
206184
HRESULT AssemblyBinder::TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind)
207185
{
208186
HRESULT hr = S_OK;
@@ -296,6 +274,7 @@ namespace BINDER_SPACE
296274

297275
if (szCodeBase == NULL)
298276
{
277+
_ASSERTE(pAssemblyName != NULL);
299278
IF_FAIL_GO(BindByName(pApplicationContext,
300279
pAssemblyName,
301280
false, // skipFailureCaching
@@ -372,9 +351,6 @@ namespace BINDER_SPACE
372351
Assembly **ppSystemAssembly,
373352
bool fBindToNativeImage)
374353
{
375-
// Indirect check that binder was initialized.
376-
_ASSERTE(g_BinderVariables != NULL);
377-
378354
HRESULT hr = S_OK;
379355

380356
_ASSERTE(ppSystemAssembly != NULL);
@@ -468,9 +444,6 @@ namespace BINDER_SPACE
468444
SString& cultureName,
469445
Assembly** ppSystemAssembly)
470446
{
471-
// Indirect check that binder was initialized.
472-
_ASSERTE(g_BinderVariables != NULL);
473-
474447
HRESULT hr = S_OK;
475448

476449
_ASSERTE(ppSystemAssembly != NULL);
@@ -781,8 +754,7 @@ namespace BINDER_SPACE
781754

782755
if (!tpaListAssembly)
783756
{
784-
SString &culture = pRequestedAssemblyName->GetCulture();
785-
if (culture.IsEmpty() || culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
757+
if (pRequestedAssemblyName->IsNeutralCulture())
786758
{
787759
dwIncludeFlags |= AssemblyName::EXCLUDE_CULTURE;
788760
}
@@ -912,10 +884,10 @@ namespace BINDER_SPACE
912884
// names as platform ones.
913885

914886
HRESULT hr = S_OK;
915-
SString& simpleNameRef = pRequestedAssemblyName->GetSimpleName();
887+
const SString& simpleNameRef = pRequestedAssemblyName->GetSimpleName();
916888
SString& cultureRef = pRequestedAssemblyName->GetCulture();
917889

918-
_ASSERTE(!cultureRef.IsEmpty() && !cultureRef.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral));
890+
_ASSERTE(!pRequestedAssemblyName->IsNeutralCulture());
919891

920892
ReleaseHolder<Assembly> pAssembly;
921893
SString fileName;
@@ -956,7 +928,7 @@ namespace BINDER_SPACE
956928
bool useNativeImages,
957929
Assembly **ppAssembly)
958930
{
959-
SString &simpleName = pRequestedAssemblyName->GetSimpleName();
931+
const SString &simpleName = pRequestedAssemblyName->GetSimpleName();
960932
BinderTracing::PathSource pathSource = useNativeImages ? BinderTracing::PathSource::AppNativeImagePaths : BinderTracing::PathSource::AppPaths;
961933
// Loop through the binding paths looking for a matching assembly
962934
for (DWORD i = 0; i < pBindingPaths->GetCount(); i++)
@@ -1045,17 +1017,16 @@ namespace BINDER_SPACE
10451017
{
10461018
HRESULT hr = S_OK;
10471019

1048-
SString &culture = pRequestedAssemblyName->GetCulture();
10491020
bool fPartialMatchOnTpa = false;
10501021

1051-
if (!culture.IsEmpty() && !culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
1022+
if (!pRequestedAssemblyName->IsNeutralCulture())
10521023
{
10531024
IF_FAIL_GO(BindSatelliteResource(pApplicationContext, pRequestedAssemblyName, pBindResult));
10541025
}
10551026
else
10561027
{
10571028
ReleaseHolder<Assembly> pTPAAssembly;
1058-
SString& simpleName = pRequestedAssemblyName->GetSimpleName();
1029+
const SString& simpleName = pRequestedAssemblyName->GetSimpleName();
10591030

10601031
// Is assembly in the bundle?
10611032
// Single-file bundle contents take precedence over TPA.
@@ -1436,7 +1407,6 @@ namespace BINDER_SPACE
14361407
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
14371408
HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
14381409
/* in */ AssemblyName *pAssemblyName,
1439-
/* in */ IAssemblyName *pIAssemblyName,
14401410
/* in */ CLRPrivBinderCoreCLR *pTPABinder,
14411411
/* out */ Assembly **ppAssembly)
14421412
{
@@ -1446,8 +1416,8 @@ HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedA
14461416

14471417
// RuntimeInvokeHostAssemblyResolver will perform steps 2-4 of CLRPrivBinderAssemblyLoadContext::BindAssemblyByName.
14481418
ICLRPrivAssembly *pLoadedAssembly = NULL;
1449-
hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin, pIAssemblyName,
1450-
pTPABinder, pAssemblyName, &pLoadedAssembly);
1419+
hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin,
1420+
pAssemblyName, pTPABinder, &pLoadedAssembly);
14511421
if (SUCCEEDED(hr))
14521422
{
14531423
_ASSERTE(pLoadedAssembly != NULL);
@@ -1467,9 +1437,6 @@ HRESULT AssemblyBinder::BindUsingPEImage(/* in */ ApplicationContext *pApplicat
14671437
{
14681438
HRESULT hr = E_FAIL;
14691439

1470-
// Indirect check that binder was initialized.
1471-
_ASSERTE(g_BinderVariables != NULL);
1472-
14731440
LONG kContextVersion = 0;
14741441
BindResult bindResult;
14751442

0 commit comments

Comments
 (0)