Skip to content
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

Remove IAssemblyName (and various fusion remnants) #50755

Merged
merged 8 commits into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 0 additions & 5 deletions src/coreclr/binder/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ set(BINDER_COMMON_SOURCES
clrprivbindercoreclr.cpp
coreclrbindercommon.cpp
failurecache.cpp
fusionassemblyname.cpp
stringlexer.cpp
textualidentityparser.cpp
utils.cpp
variables.cpp
)

set(BINDER_COMMON_HEADERS
Expand All @@ -42,15 +40,12 @@ set(BINDER_COMMON_HEADERS
inc/coreclrbindercommon.h
inc/failurecache.hpp
inc/failurecachehashtraits.hpp
inc/fusionassemblyname.hpp
inc/fusionhelpers.hpp
inc/loadcontext.hpp
inc/loadcontext.inl
inc/stringlexer.hpp
inc/stringlexer.inl
inc/textualidentityparser.hpp
inc/utils.hpp
inc/variables.hpp
)

set(BINDER_SOURCES
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/binder/applicationcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "failurecache.hpp"
#include "assemblyidentitycache.hpp"
#include "utils.hpp"
#include "variables.hpp"
#include "ex.h"
#include "clr/fs/path.h"
using namespace clr::fs;
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/binder/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ namespace BINDER_SPACE
return (pAsmName == nullptr ? nullptr : (LPCWSTR)pAsmName->GetSimpleName());
}

HRESULT Assembly::BindAssemblyByName(IAssemblyName * pIAssemblyName, ICLRPrivAssembly ** ppAssembly)
HRESULT Assembly::BindAssemblyByName(struct AssemblyNameData *pAssemblyNameData, ICLRPrivAssembly ** ppAssembly)
elinor-fung marked this conversation as resolved.
Show resolved Hide resolved
{
return (m_pBinder == NULL) ? E_FAIL : m_pBinder->BindAssemblyByName(pIAssemblyName, ppAssembly);
return (m_pBinder == NULL) ? E_FAIL : m_pBinder->BindAssemblyByName(pAssemblyNameData, ppAssembly);
}

HRESULT Assembly::GetBinderID(UINT_PTR *pBinderId)
Expand Down
61 changes: 14 additions & 47 deletions src/coreclr/binder/assemblybinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,20 @@
#include "bindresult.inl"
#include "failurecache.hpp"
#include "utils.hpp"
#include "variables.hpp"
#include "stringarraylist.h"
#include "configuration.h"

#define APP_DOMAIN_LOCKED_UNLOCKED 0x02
#define APP_DOMAIN_LOCKED_CONTEXT 0x04

#ifndef IMAGE_FILE_MACHINE_ARM64
#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
#endif

BOOL IsCompilationProcess();

#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
#include "clrprivbindercoreclr.h"
#include "clrprivbinderassemblyloadcontext.h"
// Helper function in the VM, invoked by the Binder, to invoke the host assembly resolver
extern HRESULT RuntimeInvokeHostAssemblyResolver(INT_PTR pManagedAssemblyLoadContextToBindWithin,
IAssemblyName *pIAssemblyName, CLRPrivBinderCoreCLR *pTPABinder,
BINDER_SPACE::AssemblyName *pAssemblyName, ICLRPrivAssembly **ppLoadedAssembly);
BINDER_SPACE::AssemblyName *pAssemblyName,
CLRPrivBinderCoreCLR *pTPABinder,
ICLRPrivAssembly **ppLoadedAssembly);

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

Expand Down Expand Up @@ -112,12 +106,13 @@ namespace BINDER_SPACE
return true;
}

const WCHAR* s_httpURLPrefix = W("http://");
HRESULT URLToFullPath(PathString &assemblyPath)
{
HRESULT hr = S_OK;

SString::Iterator pos = assemblyPath.Begin();
if (assemblyPath.MatchCaseInsensitive(pos, g_BinderVariables->httpURLPrefix))
if (assemblyPath.MatchCaseInsensitive(pos, s_httpURLPrefix))
{
// HTTP downloads are unsupported
hr = FUSION_E_CODE_DOWNLOAD_DISABLED;
Expand Down Expand Up @@ -186,23 +181,6 @@ namespace BINDER_SPACE
#endif // !CROSSGEN_COMPILE
};

/* static */
HRESULT AssemblyBinder::Startup()
{
STATIC_CONTRACT_NOTHROW;

HRESULT hr = S_OK;

// This should only be called once
_ASSERTE(g_BinderVariables == NULL);
g_BinderVariables = new Variables();
IF_FAIL_GO(g_BinderVariables->Init());

Exit:
return hr;
}


HRESULT AssemblyBinder::TranslatePEToArchitectureType(DWORD *pdwPAFlags, PEKIND *PeKind)
{
HRESULT hr = S_OK;
Expand Down Expand Up @@ -296,6 +274,7 @@ namespace BINDER_SPACE

if (szCodeBase == NULL)
{
_ASSERTE(pAssemblyName != NULL);
IF_FAIL_GO(BindByName(pApplicationContext,
pAssemblyName,
false, // skipFailureCaching
Expand Down Expand Up @@ -372,9 +351,6 @@ namespace BINDER_SPACE
Assembly **ppSystemAssembly,
bool fBindToNativeImage)
{
// Indirect check that binder was initialized.
_ASSERTE(g_BinderVariables != NULL);

HRESULT hr = S_OK;

_ASSERTE(ppSystemAssembly != NULL);
Expand Down Expand Up @@ -468,9 +444,6 @@ namespace BINDER_SPACE
SString& cultureName,
Assembly** ppSystemAssembly)
{
// Indirect check that binder was initialized.
_ASSERTE(g_BinderVariables != NULL);

HRESULT hr = S_OK;

_ASSERTE(ppSystemAssembly != NULL);
Expand Down Expand Up @@ -781,8 +754,7 @@ namespace BINDER_SPACE

if (!tpaListAssembly)
{
SString &culture = pRequestedAssemblyName->GetCulture();
if (culture.IsEmpty() || culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
if (pRequestedAssemblyName->IsNeutralCulture())
{
dwIncludeFlags |= AssemblyName::EXCLUDE_CULTURE;
}
Expand Down Expand Up @@ -912,10 +884,10 @@ namespace BINDER_SPACE
// names as platform ones.

HRESULT hr = S_OK;
SString& simpleNameRef = pRequestedAssemblyName->GetSimpleName();
const SString& simpleNameRef = pRequestedAssemblyName->GetSimpleName();
SString& cultureRef = pRequestedAssemblyName->GetCulture();

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

ReleaseHolder<Assembly> pAssembly;
SString fileName;
Expand Down Expand Up @@ -956,7 +928,7 @@ namespace BINDER_SPACE
bool useNativeImages,
Assembly **ppAssembly)
{
SString &simpleName = pRequestedAssemblyName->GetSimpleName();
const SString &simpleName = pRequestedAssemblyName->GetSimpleName();
BinderTracing::PathSource pathSource = useNativeImages ? BinderTracing::PathSource::AppNativeImagePaths : BinderTracing::PathSource::AppPaths;
// Loop through the binding paths looking for a matching assembly
for (DWORD i = 0; i < pBindingPaths->GetCount(); i++)
Expand Down Expand Up @@ -1045,17 +1017,16 @@ namespace BINDER_SPACE
{
HRESULT hr = S_OK;

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

if (!culture.IsEmpty() && !culture.EqualsCaseInsensitive(g_BinderVariables->cultureNeutral))
if (!pRequestedAssemblyName->IsNeutralCulture())
{
IF_FAIL_GO(BindSatelliteResource(pApplicationContext, pRequestedAssemblyName, pBindResult));
}
else
{
ReleaseHolder<Assembly> pTPAAssembly;
SString& simpleName = pRequestedAssemblyName->GetSimpleName();
const SString& simpleName = pRequestedAssemblyName->GetSimpleName();

// Is assembly in the bundle?
// Single-file bundle contents take precedence over TPA.
Expand Down Expand Up @@ -1436,7 +1407,6 @@ namespace BINDER_SPACE
#if !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedAssemblyLoadContextToBindWithin,
/* in */ AssemblyName *pAssemblyName,
/* in */ IAssemblyName *pIAssemblyName,
/* in */ CLRPrivBinderCoreCLR *pTPABinder,
/* out */ Assembly **ppAssembly)
{
Expand All @@ -1446,8 +1416,8 @@ HRESULT AssemblyBinder::BindUsingHostAssemblyResolver(/* in */ INT_PTR pManagedA

// RuntimeInvokeHostAssemblyResolver will perform steps 2-4 of CLRPrivBinderAssemblyLoadContext::BindAssemblyByName.
ICLRPrivAssembly *pLoadedAssembly = NULL;
hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin, pIAssemblyName,
pTPABinder, pAssemblyName, &pLoadedAssembly);
hr = RuntimeInvokeHostAssemblyResolver(pManagedAssemblyLoadContextToBindWithin,
pAssemblyName, pTPABinder, &pLoadedAssembly);
if (SUCCEEDED(hr))
{
_ASSERTE(pLoadedAssembly != NULL);
Expand All @@ -1467,9 +1437,6 @@ HRESULT AssemblyBinder::BindUsingPEImage(/* in */ ApplicationContext *pApplicat
{
HRESULT hr = E_FAIL;

// Indirect check that binder was initialized.
_ASSERTE(g_BinderVariables != NULL);

LONG kContextVersion = 0;
BindResult bindResult;

Expand Down
Loading