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 built-in WinRT support from the runtime #36715

Merged
merged 71 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
150b175
Remove WinRT-specific marshalers from the runtime side.
jkoritzinsky Apr 20, 2020
77a50e7
Remove managed WinRT support in System.Private.CoreLib
jkoritzinsky Apr 20, 2020
2166b6b
Block loading WinRT types into .NET.
jkoritzinsky Apr 21, 2020
eb3ca0f
Remove System.Runtime.InteropServices.WindowsRuntime, System.Runtime.…
jkoritzinsky Apr 21, 2020
ff74bba
Remove WinRT-specific code in hr->exception translation.
jkoritzinsky Apr 21, 2020
1e05d67
Remove WinRT stub types.
jkoritzinsky Apr 21, 2020
34f688c
Remove WinRT type redirection barring some vestigal parts in the RCW …
jkoritzinsky Apr 22, 2020
4f54887
Remove last vestiages of projections. Something is causing failures i…
jkoritzinsky Apr 23, 2020
1a7bd15
Just remove this branch that was only relevant in WinRT. It's the cor…
jkoritzinsky Apr 24, 2020
27fe8c4
Don't throw away the return value here, actually use it.
jkoritzinsky Apr 24, 2020
21d7cd5
Remove WinRTTypeNameConverter
jkoritzinsky Apr 24, 2020
cd2eb2f
Remove winrthelpers.h and winrthelpers.cpp. Start putting blocks in f…
jkoritzinsky Apr 24, 2020
6877fd5
Remove old winrthost that we never shipped.
jkoritzinsky Apr 24, 2020
3bdfb39
Remove the WinMD binder and related WinMD utilities.
jkoritzinsky Apr 24, 2020
346b52a
Add back automatic WinRT apartment initialization.
jkoritzinsky Apr 24, 2020
b68881d
Remove unused delay loads.
jkoritzinsky Apr 24, 2020
a143172
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky Apr 24, 2020
00951a9
Restore WinRTSupported() to make sure we correctly initialize WinRT t…
jkoritzinsky Apr 28, 2020
d0101e3
Clean up comments and remove much of the winmd-specific assembly/type…
jkoritzinsky Apr 28, 2020
2ccf720
Remove rooting of now-removed types.
jkoritzinsky Apr 28, 2020
d275680
Remove always-false WinRT flags from EEClass and related code.
jkoritzinsky Apr 28, 2020
1de6a16
Remove WinRT-specific CCW flags.
jkoritzinsky Apr 28, 2020
4e0512d
Remove WinRT weak handles support in the runtime.
jkoritzinsky Apr 29, 2020
73687a4
Remove WinRT references in AppDomain and remove dead code from StubHe…
jkoritzinsky Apr 29, 2020
e22706b
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky Apr 29, 2020
4fc4fbd
Revert "Remove WinRT weak handles support in the runtime."
jkoritzinsky May 1, 2020
a10f75c
Reduce amount of work before we refuse to load a winmd.
jkoritzinsky May 7, 2020
2c54204
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky May 7, 2020
e847ec0
Throw when resolving the assemblyRef entry. Don't even get to the poi…
jkoritzinsky May 7, 2020
b36bec0
Remove more unneeded support for winmds in the assembly loader.
jkoritzinsky May 7, 2020
2325d85
Remove crossgen/ngen-specific winmd code paths and options.
jkoritzinsky May 7, 2020
f93372e
Remove more winmd-specific support in module loading that's unneeded.
jkoritzinsky May 7, 2020
572ac93
Remove references to the Windows namespace and remove some unused res…
jkoritzinsky May 7, 2020
7cc414f
Remove all mentions of winmds outside of ilasm/ildasm.
jkoritzinsky May 7, 2020
d3c8b6d
Remove remaining winrt support in fieldmarshaler support.
jkoritzinsky May 7, 2020
b0aac23
Remove IRestrictedErrorInfo support.
jkoritzinsky May 7, 2020
631a944
Remove delay load for hstring APIs since we no longer use them.
jkoritzinsky May 7, 2020
d5fe9c1
Remove unused interface from private idl.
jkoritzinsky May 7, 2020
7ede7d2
Remove WinRT support from methodtable and marshalling paths.
jkoritzinsky May 7, 2020
bef8fb8
Remove other unused WinRT-only MarshalNative methods.
jkoritzinsky May 7, 2020
104fd75
Remove WinRT mentions from docs, host, and build.
jkoritzinsky May 13, 2020
6b2596a
Remove IInspectable support and the last bit of MethodTable WinRT-rel…
jkoritzinsky May 14, 2020
5942c9a
Remove unused code from stdinterfaces.h
jkoritzinsky May 14, 2020
3ccfcc1
Remove the old reference tracking GC integration for built-in RCWs.
jkoritzinsky May 14, 2020
b398d88
Remove now-unused jupiter refcounts and pegging tracking.
jkoritzinsky May 14, 2020
c929f79
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky May 14, 2020
d3c91bd
Remove unused WinRT checks in managed code and remove Activator test …
jkoritzinsky May 14, 2020
0072cfe
Remove now-dead code.
jkoritzinsky May 14, 2020
b8aa672
Remove dead entries.
jkoritzinsky May 14, 2020
360869d
Remove some dead marshaler code.
jkoritzinsky May 14, 2020
cc8781e
Remove more winrt-specific dead code.
jkoritzinsky May 14, 2020
796c1c8
Fix all-up build excluding the fix for dotnet/arcade#5490
jkoritzinsky May 15, 2020
2ec132e
Fix non-Windows build.
jkoritzinsky May 15, 2020
cac2479
Remove WinRT-specific paths from dynamic support.
jkoritzinsky May 18, 2020
fc14826
Remove codepaths in System.Private.CoreLib that either worked via ref…
jkoritzinsky May 18, 2020
476e43a
Fix native test build
jkoritzinsky May 19, 2020
848062a
Fix x86 CoreCLR build.
jkoritzinsky May 19, 2020
1d7b7b4
Fix managed test build.
jkoritzinsky May 19, 2020
d8e100e
Remove unneeded default interface field that was causing crossgen ass…
jkoritzinsky May 19, 2020
3c4f0ce
Fix classifying ComImported constructors.
jkoritzinsky May 19, 2020
0a99b43
Root the System.__ComObject constructor for the IL Linker. Otherwise …
jkoritzinsky May 20, 2020
068fb3c
Don't run the WinRT blocking test off of Windows.
jkoritzinsky May 20, 2020
a26e275
Fix failing tests.
jkoritzinsky May 20, 2020
d24fee5
Fix typo
jkoritzinsky May 20, 2020
cb4a61a
Update the comment for the refcount field.
jkoritzinsky May 21, 2020
39158b4
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky May 21, 2020
b3ff1aa
Remove unused flags on ComToClrCall and fix spacing.
jkoritzinsky May 21, 2020
336542e
Add back IAgileObject support in CCWs
jkoritzinsky May 22, 2020
ec476cb
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky May 26, 2020
c53ba60
Remove now inapplicable assert instead of incorrectly simplifying it.
jkoritzinsky May 27, 2020
45ad790
Merge branch 'master' of https://github.com/dotnet/runtime into remov…
jkoritzinsky May 28, 2020
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
Prev Previous commit
Next Next commit
Remove more unneeded support for winmds in the assembly loader.
  • Loading branch information
jkoritzinsky committed May 7, 2020
commit b36bec08716e692d0c8f0918e7e6ae5a867a87dc
7 changes: 0 additions & 7 deletions src/coreclr/src/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5780,13 +5780,6 @@ HRESULT DacDbiInterfaceImpl::IsWinRTModule(VMPTR_Module vmModule, BOOL& isWinRT)
HRESULT hr = S_OK;
isWinRT = FALSE;

EX_TRY
{
Module* pModule = vmModule.GetDacPtr();
isWinRT = pModule->GetFile()->GetAssembly()->IsWindowsRuntime();
}
EX_CATCH_HRESULT(hr);

return hr;
}

Expand Down
9 changes: 1 addition & 8 deletions src/coreclr/src/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,10 +1043,6 @@ Module * Assembly::FindModuleByTypeRef(
// Do this first because it has a strong contract
Assembly * pAssembly = NULL;

#if defined(FEATURE_COMINTEROP) || !defined(DACCESS_COMPILE)
LPCUTF8 szNamespace = NULL;
LPCUTF8 szClassName = NULL;
#endif
if (loadFlag == Loader::SafeLookup)
{
pAssembly = pModule->LookupAssemblyRef(tkType);
Expand All @@ -1070,10 +1066,7 @@ Module * Assembly::FindModuleByTypeRef(
}


DomainAssembly * pDomainAssembly = pModule->LoadAssembly(
tkType,
szNamespace,
szClassName);
DomainAssembly * pDomainAssembly = pModule->LoadAssembly(tkType);


if (pDomainAssembly == NULL)
Expand Down
9 changes: 0 additions & 9 deletions src/coreclr/src/vm/assemblyspec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,15 +250,6 @@ class AssemblySpec : public BaseAssemblySpec
}
}

// Returns true if the object can be used to bind to the target assembly.
// One case in which this is not true is when the content type is WinRT
// but no type name has been set.
inline bool HasBindableIdentity() const
{
STATIC_CONTRACT_LIMITED_METHOD;
return TRUE;
}

inline BOOL CanUseWithBindingCache() const
{
STATIC_CONTRACT_LIMITED_METHOD;
Expand Down
18 changes: 3 additions & 15 deletions src/coreclr/src/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4813,14 +4813,7 @@ Module::GetAssemblyRefFlags(
} // Module::GetAssemblyRefFlags

#ifndef DACCESS_COMPILE

// Arguments:
// szWinRtTypeNamespace ... Namespace of WinRT type.
// szWinRtTypeClassName ... Name of WinRT type, NULL for non-WinRT (classic) types.
DomainAssembly * Module::LoadAssembly(
mdAssemblyRef kAssemblyRef,
LPCUTF8 szWinRtTypeNamespace,
LPCUTF8 szWinRtTypeClassName)
DomainAssembly * Module::LoadAssembly(mdAssemblyRef kAssemblyRef)
{
CONTRACT(DomainAssembly *)
{
Expand All @@ -4830,7 +4823,6 @@ DomainAssembly * Module::LoadAssembly(
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM();); }
MODE_ANY;
POSTCONDITION(CheckPointer(RETVAL, NULL_NOT_OK));
//POSTCONDITION((CheckPointer(GetAssemblyIfLoaded(kAssemblyRef, szWinRtTypeNamespace, szWinRtTypeClassName)), NULL_NOT_OK));
}
CONTRACT_END;

Expand All @@ -4844,22 +4836,18 @@ DomainAssembly * Module::LoadAssembly(
Assembly * pAssembly = LookupAssemblyRef(kAssemblyRef);
if (pAssembly != NULL)
{
_ASSERTE(HasBindableIdentity(kAssemblyRef));

pDomainAssembly = pAssembly->GetDomainAssembly();
::GetAppDomain()->LoadDomainFile(pDomainAssembly, FILE_LOADED);

RETURN pDomainAssembly;
}

bool fHasBindableIdentity = HasBindableIdentity(kAssemblyRef);
bool fHasBindableIdentity = true;

{
PEAssemblyHolder pFile = GetDomainAssembly()->GetFile()->LoadAssembly(
kAssemblyRef,
NULL,
szWinRtTypeNamespace,
szWinRtTypeClassName);
NULL);
AssemblySpec spec;
spec.InitializeSpec(kAssemblyRef, GetMDImport(), GetDomainAssembly());
// Set the binding context in the AssemblySpec if one is available. This can happen if the LoadAssembly ended up
Expand Down
11 changes: 1 addition & 10 deletions src/coreclr/src/vm/ceeload.h
Original file line number Diff line number Diff line change
Expand Up @@ -2159,21 +2159,12 @@ class Module
Assembly *GetAssemblyIfLoadedFromNativeAssemblyRefWithRefDefMismatch(mdAssemblyRef kAssemblyRef, BOOL *pfDiscoveredAssemblyRefMatchesTargetDefExactly);
public:

DomainAssembly * LoadAssembly(
mdAssemblyRef kAssemblyRef,
LPCUTF8 szWinRtTypeNamespace = NULL,
LPCUTF8 szWinRtTypeClassName = NULL);
DomainAssembly * LoadAssembly(mdAssemblyRef kAssemblyRef);
Module *GetModuleIfLoaded(mdFile kFile, BOOL onlyLoadedInAppDomain, BOOL loadAllowed);
DomainFile *LoadModule(AppDomain *pDomain, mdFile kFile, BOOL loadResources = TRUE, BOOL bindOnly = FALSE);
PTR_Module LookupModule(mdToken kFile, BOOL loadResources = TRUE); //wrapper over GetModuleIfLoaded, takes modulerefs as well
DWORD GetAssemblyRefFlags(mdAssemblyRef tkAssemblyRef);

bool HasBindableIdentity(mdAssemblyRef tkAssemblyRef)
{
WRAPPER_NO_CONTRACT;
return !IsAfContentType_WindowsRuntime(GetAssemblyRefFlags(tkAssemblyRef));
}

// RID maps
TypeHandle LookupTypeDef(mdTypeDef token, ClassLoadLevel *pLoadLevel = NULL)
{
Expand Down
37 changes: 8 additions & 29 deletions src/coreclr/src/vm/compile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1296,38 +1296,17 @@ void CEECompileInfo::EncodeModuleAsIndex(CORINFO_MODULE_HANDLE fromHandle,
if (!pRefCache)
ThrowOutOfMemory();

result = pRefCache->m_sAssemblyRefMap.LookupValue((UPTR)assembly, NULL);

if (!assembly->GetManifestFile()->HasBindableIdentity())
{
// If the module that we'd like to encode for a later fixup doesn't have
// a bindable identity, then this will fail at runtime. So, we ask the
// compilation domain for a matching assembly with a bindable identity.
// This is possible because this module must have been bound in the past,
// and the compilation domain will keep track of at least one corresponding
// bindable identity.
AssemblySpec defSpec;
defSpec.InitializeSpec(assembly->GetManifestFile());

AssemblySpec* pRefSpec = pDomain->FindAssemblyRefSpecForDefSpec(&defSpec);
_ASSERTE(pRefSpec != nullptr);

IfFailThrow(pRefSpec->EmitToken(pAssemblyEmit, &token, TRUE, TRUE));
token += fromModule->GetAssemblyRefMax();
}
if (result == (UPTR)INVALIDENTRY)
token = fromModule->FindAssemblyRef(assembly);
else
{
result = pRefCache->m_sAssemblyRefMap.LookupValue((UPTR)assembly, NULL);

if (result == (UPTR)INVALIDENTRY)
token = fromModule->FindAssemblyRef(assembly);
else
token = (mdAssemblyRef) result;
token = (mdAssemblyRef) result;

if (IsNilToken(token))
{
token = fromAssembly->AddAssemblyRef(assembly, pAssemblyEmit);
token += fromModule->GetAssemblyRefMax();
}
if (IsNilToken(token))
{
token = fromAssembly->AddAssemblyRef(assembly, pAssemblyEmit);
token += fromModule->GetAssemblyRefMax();
}

*pIndex = RidFromToken(token);
Expand Down
7 changes: 0 additions & 7 deletions src/coreclr/src/vm/domainfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,13 +998,6 @@ void DomainFile::FinishLoad()

// Are we absolutely required to use a native image?
CheckZapRequired();

// If this is a winmd file, throw a bad image format exeption. We don't support winmds.
PEFile* peFile = GetFile();
if (peFile && peFile->AsAssembly()->IsWindowsRuntime() && peFile->HasHostAssembly())
{
ThrowHR(COR_E_BADIMAGEFORMAT);
}
#endif // FEATURE_PREJIT

// Flush any log messages
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/src/vm/pefile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1510,9 +1510,7 @@ void PEFile::GetEmbeddedResource(DWORD dwOffset, DWORD *cbResource, PBYTE *pbInM
PEAssembly *
PEFile::LoadAssembly(
mdAssemblyRef kAssemblyRef,
IMDInternalImport * pImport, // = NULL
LPCUTF8 szWinRtTypeNamespace, // = NULL
LPCUTF8 szWinRtTypeClassName) // = NULL
IMDInternalImport * pImport)
{
CONTRACT(PEAssembly *)
{
Expand Down
15 changes: 2 additions & 13 deletions src/coreclr/src/vm/pefile.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ class PEFile

PEAssembly * LoadAssembly(
mdAssemblyRef kAssemblyRef,
IMDInternalImport * pImport = NULL,
LPCUTF8 szWinRtTypeNamespace = NULL,
LPCUTF8 szWinRtTypeClassName = NULL);
IMDInternalImport * pImport = NULL);

// ------------------------------------------------------------
// Logging
Expand Down Expand Up @@ -720,20 +718,11 @@ class PEAssembly : public PEFile
PTR_PEFile GetCreator()
{ LIMITED_METHOD_CONTRACT; return m_creator; }

// Returns TRUE if the assembly is .winmd file (WinRT assembly)
bool IsWindowsRuntime();

// Used to determine if this assembly has an identity that may be used for
// binding purposes. Currently this is true for standard .NET assemblies
// and false for WinRT assemblies (where assemblies are identified by their
// member types).
bool HasBindableIdentity();

// Indicates if the assembly can be cached in a binding cache such as AssemblySpecBindingCache.
inline bool CanUseWithBindingCache()
{
STATIC_CONTRACT_WRAPPER;
return (HasBindableIdentity());
return true;
}
};

Expand Down
30 changes: 0 additions & 30 deletions src/coreclr/src/vm/pefile.inl
Original file line number Diff line number Diff line change
Expand Up @@ -1445,34 +1445,4 @@ inline PEFile* PEFile::Dummy()
{
return (PEFile*)(-1);
}

inline bool PEAssembly::HasBindableIdentity()
{
CONTRACTL
{
INSTANCE_CHECK;
if (FORBIDGC_LOADER_USE_ENABLED()) NOTHROW; else THROWS;
if (FORBIDGC_LOADER_USE_ENABLED()) GC_NOTRIGGER; else GC_TRIGGERS;
if (FORBIDGC_LOADER_USE_ENABLED()) FORBID_FAULT; else { INJECT_FAULT(COMPlusThrowOM()); }
MODE_ANY;
SUPPORTS_DAC;
}
CONTRACTL_END

return !IsAfContentType_WindowsRuntime(GetFlags());
}

inline bool PEAssembly::IsWindowsRuntime()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

return IsAfContentType_WindowsRuntime(GetFlags());
}

#endif // PEFILE_INL_