summaryrefslogtreecommitdiff
path: root/src/vm/pefile.cpp
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-08-11 07:43:16 -0700
committerGitHub <noreply@github.com>2018-08-11 07:43:16 -0700
commitaf4ec7c89d0192ad14392da04e8c097da8ec9e48 (patch)
tree0b3018c1c576114d2b5b0f355df6ff48972a6c5d /src/vm/pefile.cpp
parentf551543427176850c84b9e11c7b8d528c3f282a7 (diff)
downloadcoreclr-af4ec7c89d0192ad14392da04e8c097da8ec9e48.tar.gz
coreclr-af4ec7c89d0192ad14392da04e8c097da8ec9e48.tar.bz2
coreclr-af4ec7c89d0192ad14392da04e8c097da8ec9e48.zip
Make RuntimeType sealed and deleted support for introspection only loads (#19427)
- Sealed Runtime makes `is RuntimeType` and similar checks faster. These checks are fairly common in reflection. - Delete support for introspection only loads from the runtime. We do not plan to use in .NET Core. The support for introspection loads inherited from RuntimeType and thus it is incompatible with sealed RuntimeType.
Diffstat (limited to 'src/vm/pefile.cpp')
-rw-r--r--src/vm/pefile.cpp74
1 files changed, 14 insertions, 60 deletions
diff --git a/src/vm/pefile.cpp b/src/vm/pefile.cpp
index 77c99f6191..7cfa05779a 100644
--- a/src/vm/pefile.cpp
+++ b/src/vm/pefile.cpp
@@ -212,9 +212,6 @@ static void ValidatePEFileMachineType(PEFile *peFile)
{
STANDARD_VM_CONTRACT;
- if (peFile->IsIntrospectionOnly())
- return; // ReflectionOnly assemblies permitted to violate CPU restrictions
-
if (peFile->IsDynamic())
return; // PEFiles for ReflectionEmit assemblies don't cache the machine type.
@@ -280,12 +277,12 @@ void PEFile::LoadLibrary(BOOL allowNativeSkip/*=TRUE*/) // if allowNativeSkip==F
// Resource images are always flat.
if (IsResource())
{
- GetILimage()->LoadNoMetaData(IsIntrospectionOnly());
+ GetILimage()->LoadNoMetaData();
RETURN;
}
#if !defined(_TARGET_64BIT_)
- if (!HasNativeImage() && (!GetILimage()->Has32BitNTHeaders()) && !IsIntrospectionOnly())
+ if (!HasNativeImage() && !GetILimage()->Has32BitNTHeaders())
{
// Tried to load 64-bit assembly on 32-bit platform.
EEFileLoadException::Throw(this, COR_E_BADIMAGEFORMAT, NULL);
@@ -298,16 +295,6 @@ void PEFile::LoadLibrary(BOOL allowNativeSkip/*=TRUE*/) // if allowNativeSkip==F
EnsureImageOpened();
}
- if (IsIntrospectionOnly())
- {
- GetILimage()->LoadForIntrospection();
- RETURN;
- }
-
-
- //---- Below this point, only do the things necessary for execution ----
- _ASSERTE(!IsIntrospectionOnly());
-
#ifdef FEATURE_PREJIT
// For on-disk Dlls, we can call LoadLibrary
if (IsDll() && !((HasNativeImage()?m_nativeImage:GetILimage())->GetPath().IsEmpty()))
@@ -463,13 +450,6 @@ BOOL PEFile::Equals(PEFile *pFile)
if (pFile == this)
return TRUE;
-
- // Execution and introspection files are NOT equal
- if ( (!IsIntrospectionOnly()) != !(pFile->IsIntrospectionOnly()) )
- {
- return FALSE;
- }
-
// Different host assemblies cannot be equal unless they are associated with the same host binder
// It's ok if only one has a host binder because multiple threads can race to load the same assembly
// and that may cause temporary candidate PEAssembly objects that never get bound to a host assembly
@@ -1633,11 +1613,11 @@ PEFile::LoadAssembly(
AssemblySpec spec;
- spec.InitializeSpec(kAssemblyRef, pImport, GetAppDomain()->FindAssembly(GetAssembly()), IsIntrospectionOnly());
+ spec.InitializeSpec(kAssemblyRef, pImport, GetAppDomain()->FindAssembly(GetAssembly()));
if (szWinRtTypeClassName != NULL)
spec.SetWindowsRuntimeType(szWinRtTypeNamespace, szWinRtTypeClassName);
- RETURN GetAppDomain()->BindAssemblySpec(&spec, TRUE, IsIntrospectionOnly());
+ RETURN GetAppDomain()->BindAssemblySpec(&spec, TRUE);
}
// ------------------------------------------------------------
@@ -1805,7 +1785,7 @@ BOOL PEFile::GetResource(LPCSTR szName, DWORD *cbResource,
return FALSE;
AssemblySpec spec;
- spec.InitializeSpec(mdLinkRef, GetPersistentMDImport(), pDomainAssembly, pDomainAssembly->GetFile()->IsIntrospectionOnly());
+ spec.InitializeSpec(mdLinkRef, GetPersistentMDImport(), pDomainAssembly);
pDomainAssembly = spec.LoadDomainAssembly(FILE_LOADED);
if (dwLocation) {
@@ -1962,7 +1942,6 @@ PEAssembly::PEAssembly(
IMetaDataEmit* pEmit,
PEFile *creator,
BOOL system,
- BOOL introspectionOnly/*=FALSE*/,
PEImage * pPEImageIL /*= NULL*/,
PEImage * pPEImageNI /*= NULL*/,
ICLRPrivAssembly * pHostAssembly /*= NULL*/)
@@ -1985,14 +1964,6 @@ PEAssembly::PEAssembly(
}
CONTRACTL_END;
- if (introspectionOnly)
- {
- if (!system) // Implementation restriction: mscorlib.dll cannot be loaded as introspection. The architecture depends on there being exactly one mscorlib.
- {
- m_flags |= PEFILE_INTROSPECTIONONLY;
- }
- }
-
m_flags |= PEFILE_ASSEMBLY;
if (system)
m_flags |= PEFILE_SYSTEM;
@@ -2085,8 +2056,7 @@ PEAssembly *PEAssembly::Open(
PEAssembly * pParent,
PEImage * pPEImageIL,
PEImage * pPEImageNI,
- ICLRPrivAssembly * pHostAssembly,
- BOOL fIsIntrospectionOnly)
+ ICLRPrivAssembly * pHostAssembly)
{
STANDARD_VM_CONTRACT;
@@ -2095,7 +2065,6 @@ PEAssembly *PEAssembly::Open(
nullptr, // IMetaDataEmit
pParent, // PEFile creator
FALSE, // isSystem
- fIsIntrospectionOnly,
pPEImageIL,
pPEImageNI,
pHostAssembly);
@@ -2197,7 +2166,6 @@ PEAssembly *PEAssembly::DoOpenSystem(IUnknown * pAppCtx)
/* static */
PEAssembly *PEAssembly::OpenMemory(PEAssembly *pParentAssembly,
const void *flat, COUNT_T size,
- BOOL isIntrospectionOnly/*=FALSE*/,
CLRPrivBinderLoadFile* pBinderToUse)
{
STANDARD_VM_CONTRACT;
@@ -2206,7 +2174,7 @@ PEAssembly *PEAssembly::OpenMemory(PEAssembly *pParentAssembly,
EX_TRY
{
- result = DoOpenMemory(pParentAssembly, flat, size, isIntrospectionOnly, pBinderToUse);
+ result = DoOpenMemory(pParentAssembly, flat, size, pBinderToUse);
}
EX_HOOK
{
@@ -2246,7 +2214,6 @@ PEAssembly *PEAssembly::DoOpenMemory(
PEAssembly *pParentAssembly,
const void *flat,
COUNT_T size,
- BOOL isIntrospectionOnly,
CLRPrivBinderLoadFile* pBinderToUse)
{
CONTRACT(PEAssembly *)
@@ -2279,24 +2246,23 @@ PEAssembly *PEAssembly::DoOpenMemory(
IfFailThrow(CCoreCLRBinderHelper::GetAssemblyFromImage(image, NULL, &assembly));
bindResult.Init(assembly,FALSE,FALSE);
- RETURN new PEAssembly(&bindResult, NULL, pParentAssembly, FALSE, isIntrospectionOnly);
+ RETURN new PEAssembly(&bindResult, NULL, pParentAssembly, FALSE);
}
#endif // !CROSSGEN_COMPILE
PEAssembly* PEAssembly::Open(CoreBindResult* pBindResult,
- BOOL isSystem, BOOL isIntrospectionOnly)
+ BOOL isSystem)
{
- return new PEAssembly(pBindResult,NULL,NULL,isSystem,isIntrospectionOnly);
+ return new PEAssembly(pBindResult,NULL,NULL,isSystem);
};
/* static */
PEAssembly *PEAssembly::Create(PEAssembly *pParentAssembly,
- IMetaDataAssemblyEmit *pAssemblyEmit,
- BOOL bIsIntrospectionOnly)
+ IMetaDataAssemblyEmit *pAssemblyEmit)
{
CONTRACT(PEAssembly *)
{
@@ -2311,7 +2277,7 @@ PEAssembly *PEAssembly::Create(PEAssembly *pParentAssembly,
// we have.)
SafeComHolder<IMetaDataEmit> pEmit;
pAssemblyEmit->QueryInterface(IID_IMetaDataEmit, (void **)&pEmit);
- PEAssemblyHolder pFile(new PEAssembly(NULL, pEmit, pParentAssembly, FALSE, bIsIntrospectionOnly));
+ PEAssemblyHolder pFile(new PEAssembly(NULL, pEmit, pParentAssembly, FALSE));
RETURN pFile.Extract();
}
@@ -2423,20 +2389,8 @@ void PEAssembly::VerifyStrongName()
ThrowHR(COR_E_BADIMAGEFORMAT);
}
- // Check the strong name if present.
- if (IsIntrospectionOnly())
- {
- // For introspection assemblies, we don't need to check strong names and we don't
- // need to do module hash checks.
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- }
- else
- {
- // Runtime policy on CoreCLR is to skip verification of ALL assemblies
- m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
- m_fStrongNameVerified = TRUE;
- }
-
+ // Runtime policy on CoreCLR is to skip verification of ALL assemblies
+ m_flags |= PEFILE_SKIP_MODULE_HASH_CHECKS;
m_fStrongNameVerified = TRUE;
}