diff options
author | Ryan Byington <ryanbyi@microsoft.com> | 2015-04-28 17:53:30 -0700 |
---|---|---|
committer | Ryan Byington <ryanbyi@microsoft.com> | 2015-04-28 17:53:30 -0700 |
commit | fb68f332e9123d74bd1cc7187be000bc3cbf67d2 (patch) | |
tree | e8aca912b70dd791502d977beb6262e264dda1e2 /src/vm/methodtablebuilder.cpp | |
parent | 2fd35925a66be17a46467050751c309b93f2013b (diff) | |
download | coreclr-fb68f332e9123d74bd1cc7187be000bc3cbf67d2.tar.gz coreclr-fb68f332e9123d74bd1cc7187be000bc3cbf67d2.tar.bz2 coreclr-fb68f332e9123d74bd1cc7187be000bc3cbf67d2.zip |
Updating WinRT Projections to use Facades
WinRT projections currently depend on implementation assemblies like System.Uri living in System.dll. System.Uri has already been moved out of System.dll to Internal.Uri.dll which breaks the projection for System.Uri. This change updates the WinRT projection to understand Facades like System.Runtime to resolve System.Uri.
When we load a type like System.Uri we need to know if it is a projected type. We currently do this by comparing the namespace plus type name and assembly however this only works because we know the implementation assembly at compile time.
I am changing it so that we use ClassLoader to resolve the typedef and assembly and compare the resolved assembly with the current one.
Also removing the cached assemblies as they don’t add a lot of value anymore.
[tfs-changeset: 1461733]
Diffstat (limited to 'src/vm/methodtablebuilder.cpp')
-rw-r--r-- | src/vm/methodtablebuilder.cpp | 49 |
1 files changed, 17 insertions, 32 deletions
diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index db099e2996..02846290f1 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -58,20 +58,6 @@ const char* FormatSig(MethodDesc* pMD, LoaderHeap *pHeap, AllocMemTracker *pamTr unsigned g_dupMethods = 0; #endif // _DEBUG -#ifdef FEATURE_COMINTEROP -WinMDAdapter::RedirectedTypeIndex CalculateWinRTRedirectedTypeIndex(IMDInternalImport * pInternalImport, Module * pModule, mdTypeDef cl) -{ - STANDARD_VM_CONTRACT; - - Assembly * pAssembly = pModule->GetAssembly(); - WinMDAdapter::FrameworkAssemblyIndex assemblyIndex; - if (!GetAppDomain()->FindRedirectedAssembly(pAssembly, &assemblyIndex)) - return WinMDAdapter::RedirectedTypeIndex_Invalid; - - return WinRTTypeNameConverter::GetRedirectedTypeIndexByName(pInternalImport, cl, assemblyIndex); -} -#endif // FEATURE_COMINTEROP - //========================================================================== // This function is very specific about how it constructs a EEClass. It first // determines the necessary size of the vtable and the number of statics that @@ -262,8 +248,8 @@ MethodTableBuilder::CreateClass( Module *pModule, } } - WinMDAdapter::RedirectedTypeIndex redirectedTypeIndex; - redirectedTypeIndex = CalculateWinRTRedirectedTypeIndex(pInternalImport, pModule, cl); + WinMDAdapter::RedirectedTypeIndex redirectedTypeIndex; + redirectedTypeIndex = WinRTTypeNameConverter::GetRedirectedTypeIndexByName(pModule, cl); if (redirectedTypeIndex != WinMDAdapter::RedirectedTypeIndex_Invalid) { EnsureOptionalFieldsAreAllocated(pEEClass, pamTracker, pAllocator->GetLowFrequencyHeap()); @@ -11741,30 +11727,29 @@ VOID MethodTableBuilder::CheckForSpecialTypes() } } } - else if (GetAppDomain()->IsSystemDll(pModule->GetAssembly())) + else if ((IsInterface() || IsDelegate()) && + IsTdPublic(GetHalfBakedClass()->GetAttrClass()) && + GetHalfBakedClass()->GetWinRTRedirectedTypeIndex() != WinMDAdapter::RedirectedTypeIndex_Invalid) { // 7. System.Collections.Specialized.INotifyCollectionChanged // 8. System.Collections.Specialized.NotifyCollectionChangedEventHandler // 9. System.ComponentModel.INotifyPropertyChanged // 10. System.ComponentModel.PropertyChangedEventHandler // 11. System.Windows.Input.ICommand - if ((IsInterface() || IsDelegate()) && IsTdPublic(GetHalfBakedClass()->GetAttrClass())) + LPCUTF8 pszClassName; + LPCUTF8 pszClassNamespace; + if (SUCCEEDED(pMDImport->GetNameOfTypeDef(GetCl(), &pszClassName, &pszClassNamespace))) { - LPCUTF8 pszClassName; - LPCUTF8 pszClassNamespace; - if (SUCCEEDED(pMDImport->GetNameOfTypeDef(GetCl(), &pszClassName, &pszClassNamespace))) - { - LPUTF8 pszFullyQualifiedName = NULL; - MAKE_FULLY_QUALIFIED_NAME(pszFullyQualifiedName, pszClassNamespace, pszClassName); + LPUTF8 pszFullyQualifiedName = NULL; + MAKE_FULLY_QUALIFIED_NAME(pszFullyQualifiedName, pszClassNamespace, pszClassName); - if (strcmp(pszFullyQualifiedName, g_INotifyCollectionChangedName) == 0 || - strcmp(pszFullyQualifiedName, g_NotifyCollectionChangedEventHandlerName) == 0 || - strcmp(pszFullyQualifiedName, g_INotifyPropertyChangedName) == 0 || - strcmp(pszFullyQualifiedName, g_PropertyChangedEventHandlerName) == 0 || - strcmp(pszFullyQualifiedName, g_ICommandName) == 0) - { - bmtProp->fNeedsRCWPerTypeData = true; - } + if (strcmp(pszFullyQualifiedName, g_INotifyCollectionChangedName) == 0 || + strcmp(pszFullyQualifiedName, g_NotifyCollectionChangedEventHandlerName) == 0 || + strcmp(pszFullyQualifiedName, g_INotifyPropertyChangedName) == 0 || + strcmp(pszFullyQualifiedName, g_PropertyChangedEventHandlerName) == 0 || + strcmp(pszFullyQualifiedName, g_ICommandName) == 0) + { + bmtProp->fNeedsRCWPerTypeData = true; } } } |