diff --git a/src/coreclr/debug/daccess/dacdbiimpl.cpp b/src/coreclr/debug/daccess/dacdbiimpl.cpp index 759c6998bb436..0157d9a672ac3 100644 --- a/src/coreclr/debug/daccess/dacdbiimpl.cpp +++ b/src/coreclr/debug/daccess/dacdbiimpl.cpp @@ -1487,19 +1487,12 @@ void DacDbiInterfaceImpl::GetTypeHandles(VMPTR_TypeHandle vmThExact, *pThExact = TypeHandle::FromPtr(vmThExact.GetDacPtr()); *pThApprox = TypeHandle::FromPtr(vmThApprox.GetDacPtr()); - // If we can't find the class, return the proper HR to the right side. Note: if the class is not a value class and - // the class is also not restored, then we must pretend that the class is still not loaded. We are gonna let - // unrestored value classes slide, though, and special case access to the class's parent below. - if ((pThApprox->IsNull()) || ((!pThApprox->IsValueType()) && (!pThApprox->IsRestored()))) + // If we can't find the class, return the proper HR to the right side. + if (pThApprox->IsNull()) { LOG((LF_CORDB, LL_INFO10000, "D::GASCI: class isn't loaded.\n")); ThrowHR(CORDBG_E_CLASS_NOT_LOADED); } - // If the exact type handle is not restored ignore it. - if (!pThExact->IsNull() && !pThExact->IsRestored()) - { - *pThExact = TypeHandle(); - } } // DacDbiInterfaceImpl::GetTypeHandles //----------------------------------------------------------------------------- @@ -3005,9 +2998,7 @@ TypeHandle DacDbiInterfaceImpl::GetExactClassTypeHandle(DebuggerIPCE_ExpandedTyp TypeHandle typeConstructor = ClassLoader::LookupTypeDefOrRefInModule(pModule, pTopLevelTypeData->ClassTypeData.metadataToken); - // If we can't find the class, throw the appropriate HR. Note: if the class is not a value class and - // the class is also not restored, then we must pretend that the class is still not loaded. We are gonna let - // unrestored value classes slide, though, and special case access to the class's parent below. + // If we can't find the class, throw the appropriate HR. if (typeConstructor.IsNull()) { LOG((LF_CORDB, LL_INFO10000, "D::ETITTH: class isn't loaded.\n")); diff --git a/src/coreclr/debug/daccess/inspect.cpp b/src/coreclr/debug/daccess/inspect.cpp index ec8356cf1f519..99667d9591897 100644 --- a/src/coreclr/debug/daccess/inspect.cpp +++ b/src/coreclr/debug/daccess/inspect.cpp @@ -64,9 +64,7 @@ InitFieldIter(DeepFieldDescIterator* fieldIter, includeParents = true; } - if (typeHandle.IsNull() || - !typeHandle.GetMethodTable() || - !typeHandle.IsRestored()) + if (typeHandle.IsNull() || !typeHandle.GetMethodTable()) { return E_INVALIDARG; } @@ -2683,8 +2681,7 @@ ClrDataTypeDefinition::NewFromModule(ClrDataAccess* dac, // If the type isn't loaded a metadata-query // TypeDefinition is produced. TypeHandle typeHandle = module->LookupTypeDef(token); - if (!typeHandle.IsNull() && - !typeHandle.IsRestored()) + if (!typeHandle.IsNull()) { // The type isn't fully usable so just go with metadata. typeHandle = TypeHandle(); @@ -3799,8 +3796,7 @@ ClrDataTypeInstance::NewFromModule(ClrDataAccess* dac, IXCLRDataTypeInstance** pubTypeInst) { TypeHandle typeHandle = module->LookupTypeDef(token); - if (typeHandle.IsNull() || - !typeHandle.IsRestored()) + if (typeHandle.IsNull()) { return E_INVALIDARG; } diff --git a/src/coreclr/vm/binder.cpp b/src/coreclr/vm/binder.cpp index c1b5ebc98e94c..90aa2250f27e4 100644 --- a/src/coreclr/vm/binder.cpp +++ b/src/coreclr/vm/binder.cpp @@ -232,7 +232,7 @@ NOINLINE PTR_MethodTable CoreLibBinder::LookupClassIfExist(BinderClassID id) const CoreLibClassDescription *d = (&g_CoreLib)->m_classDescriptions + (int)id; PTR_MethodTable pMT = ClassLoader::LoadTypeByNameThrowing(GetModule()->GetAssembly(), d->nameSpace, d->name, - ClassLoader::ReturnNullIfNotFound, ClassLoader::DontLoadTypes, CLASS_LOAD_UNRESTOREDTYPEKEY).AsMethodTable(); + ClassLoader::ReturnNullIfNotFound, ClassLoader::DontLoadTypes, CLASS_LOAD_APPROXPARENTS).AsMethodTable(); _ASSERTE((pMT == NULL) || (pMT->GetModule() == GetModule())); diff --git a/src/coreclr/vm/callhelpers.cpp b/src/coreclr/vm/callhelpers.cpp index 0d7e5e84f7244..7d80814a24f6b 100644 --- a/src/coreclr/vm/callhelpers.cpp +++ b/src/coreclr/vm/callhelpers.cpp @@ -357,7 +357,6 @@ void MethodDescCallSite::CallTargetWorker(const ARG_SLOT *pArguments, ARG_SLOT * { TypeHandle th = m_methodSig.GetLastTypeHandleThrowing(ClassLoader::DontLoadTypes); CONSISTENCY_CHECK(th.CheckFullyLoaded()); - CONSISTENCY_CHECK(th.IsRestored()); } } m_methodSig.Reset(); diff --git a/src/coreclr/vm/ceeload.cpp b/src/coreclr/vm/ceeload.cpp index 1deaaf4c39fd9..b1ea0f62306fc 100644 --- a/src/coreclr/vm/ceeload.cpp +++ b/src/coreclr/vm/ceeload.cpp @@ -1939,8 +1939,7 @@ void Module::FreeClassTables() while (typeDefIter.Next()) { MethodTable * pMT = typeDefIter.GetElement(); - - if (pMT != NULL && pMT->IsRestored()) + if (pMT != NULL) { pMT->GetClass()->Destruct(pMT); } @@ -1958,9 +1957,6 @@ void Module::FreeClassTables() { TypeHandle th = pEntry->GetTypeHandle(); - if (!th.IsRestored()) - continue; - // We need to call destruct on instances of EEClass whose "canonical" dependent lives in this table // There is nothing interesting to destruct on array EEClass if (!th.IsTypeDesc()) @@ -3573,8 +3569,7 @@ BOOL Module::NotifyDebuggerLoad(AppDomain *pDomain, DomainAssembly * pDomainAsse while (typeDefIter.Next()) { MethodTable * pMT = typeDefIter.GetElement(); - - if (pMT != NULL && pMT->IsRestored()) + if (pMT != NULL) { result = TypeHandle(pMT).NotifyDebuggerLoad(pDomain, attaching) || result; } @@ -3599,8 +3594,7 @@ void Module::NotifyDebuggerUnload(AppDomain *pDomain) while (typeDefIter.Next()) { MethodTable * pMT = typeDefIter.GetElement(); - - if (pMT != NULL && pMT->IsRestored()) + if (pMT != NULL) { TypeHandle(pMT).NotifyDebuggerUnload(pDomain); } diff --git a/src/coreclr/vm/classloadlevel.h b/src/coreclr/vm/classloadlevel.h index f0702d62734e9..b10d095fbf9c9 100644 --- a/src/coreclr/vm/classloadlevel.h +++ b/src/coreclr/vm/classloadlevel.h @@ -19,23 +19,9 @@ // Placeholder level used before type has been created or located in ngen image // // -// CLASS_LOAD_UNRESTOREDTYPEKEY -// -// Type lives in an ngen image and components of its type key need restoring: -// for methodtables: generic arguments, EEClass pointer, Module pointer in EEClass -// for typedescs: param type, template methodtable -// -// -// CLASS_LOAD_UNRESTORED -// -// Type lives in an ngen image and contains fields that need restoring -// (e.g. parent, interfaces, param type) -// -// // CLASS_LOAD_APPROXPARENTS // -// Type has been created, or loaded from an ngen image and fields -// have been restored, but some fields have been filled in with only +// Type has been created, but some fields have been filled in with only // "approximate" information for generic type arguments. In // particular, the parent class is approximate, and interfaces are // generic (instantiation at formal type parameters). Other @@ -71,8 +57,6 @@ enum ClassLoadLevel { CLASS_LOAD_BEGIN, - CLASS_LOAD_UNRESTOREDTYPEKEY, - CLASS_LOAD_UNRESTORED, CLASS_LOAD_APPROXPARENTS, CLASS_LOAD_EXACTPARENTS, CLASS_DEPENDENCIES_LOADED, diff --git a/src/coreclr/vm/clsload.cpp b/src/coreclr/vm/clsload.cpp index 432b647a04e15..703d58e7fcda1 100644 --- a/src/coreclr/vm/clsload.cpp +++ b/src/coreclr/vm/clsload.cpp @@ -824,7 +824,7 @@ void ClassLoader::EnsureLoaded(TypeHandle typeHnd, ClassLoadLevel level) if (typeHnd.GetLoadLevel() < level) { - if (level > CLASS_LOAD_UNRESTORED) + if (level >= CLASS_LOAD_APPROXPARENTS) { TypeKey typeKey = typeHnd.GetTypeKey(); @@ -1328,7 +1328,6 @@ ClassLoader::LoadTypeHandleThrowing( #ifndef DACCESS_COMPILE // Replace AvailableClasses Module entry with found TypeHandle if (!typeHnd.IsNull() && - typeHnd.IsRestored() && foundEntry.GetEntryType() == HashedTypeEntry::EntryType::IsHashedClassEntry && (foundEntry.GetClassHashBasedEntryValue() != NULL) && (foundEntry.GetClassHashBasedEntryValue()->GetData() != typeHnd.AsPtr())) @@ -2059,7 +2058,6 @@ TypeHandle ClassLoader::LoadTypeDefOrRefThrowing(ModuleBase *pModule, PRECONDITION(level > CLASS_LOAD_BEGIN && level <= CLASS_LOADED); POSTCONDITION(CheckPointer(RETVAL, NameHandle::OKToLoad(typeDefOrRef, tokenNotToLoad) && (fNotFoundAction == ThrowIfNotFound) ? NULL_NOT_OK : NULL_OK)); - POSTCONDITION(level <= CLASS_LOAD_UNRESTORED || RETVAL.IsNull() || RETVAL.IsRestored()); SUPPORTS_DAC; } CONTRACT_END; @@ -2630,8 +2628,7 @@ TypeHandle ClassLoader::DoIncrementalLoad(TypeKey *pTypeKey, TypeHandle typeHnd, switch (currentLevel) { - // Attain at least level CLASS_LOAD_UNRESTORED (if just locating type in ngen image) - // or at least level CLASS_LOAD_APPROXPARENTS (if creating type for the first time) + // Attain at least level CLASS_LOAD_APPROXPARENTS (if creating type for the first time) case CLASS_LOAD_BEGIN : { AllocMemTracker amTracker; @@ -2644,13 +2641,6 @@ TypeHandle ClassLoader::DoIncrementalLoad(TypeKey *pTypeKey, TypeHandle typeHnd, } break; - case CLASS_LOAD_UNRESTOREDTYPEKEY : - break; - - // Attain level CLASS_LOAD_APPROXPARENTS, starting with unrestored class - case CLASS_LOAD_UNRESTORED : - break; - // Attain level CLASS_LOAD_EXACTPARENTS case CLASS_LOAD_APPROXPARENTS : if (!typeHnd.IsTypeDesc()) diff --git a/src/coreclr/vm/eventtrace.cpp b/src/coreclr/vm/eventtrace.cpp index 127f77737db67..56f7dcf0231eb 100644 --- a/src/coreclr/vm/eventtrace.cpp +++ b/src/coreclr/vm/eventtrace.cpp @@ -1254,10 +1254,6 @@ VOID ETW::TypeSystemLog::LogTypeAndParametersIfNecessary(BulkTypeEventLogger * p } TypeHandle th = TypeHandle::FromTAddr((TADDR) thAsAddr); - if (!th.IsRestored()) - { - return; - } // Check to see if we've already logged this type. If so, bail immediately. // Otherwise, mark that it's getting logged (by adding it to the hash), and fall diff --git a/src/coreclr/vm/field.cpp b/src/coreclr/vm/field.cpp index 9b70f06e38da5..b2973d8b4c66f 100644 --- a/src/coreclr/vm/field.cpp +++ b/src/coreclr/vm/field.cpp @@ -224,7 +224,6 @@ PTR_VOID FieldDesc::GetStaticAddressHandle(PTR_VOID base) MODE_ANY; FORBID_FAULT; PRECONDITION(IsStatic()); - PRECONDITION(GetEnclosingMethodTable()->IsRestored()); } CONTRACTL_END diff --git a/src/coreclr/vm/generics.cpp b/src/coreclr/vm/generics.cpp index 40fc1b3315187..78b8c69af576a 100644 --- a/src/coreclr/vm/generics.cpp +++ b/src/coreclr/vm/generics.cpp @@ -480,8 +480,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // We never have non-virtual slots in this method table (set SetNumVtableSlots and SetNumVirtuals above) _ASSERTE(!pMT->HasNonVirtualSlots()); - pMT->GetAuxiliaryDataForWrite()->SetIsRestoredForBuildMethodTable(); - RETURN(TypeHandle(pMT)); } // ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation diff --git a/src/coreclr/vm/genmeth.cpp b/src/coreclr/vm/genmeth.cpp index 96bbc53a25e48..507eb4122a2e2 100644 --- a/src/coreclr/vm/genmeth.cpp +++ b/src/coreclr/vm/genmeth.cpp @@ -77,7 +77,6 @@ static MethodDesc* CreateMethodDesc(LoaderAllocator *pAllocator, PRECONDITION(CheckPointer(pAllocator)); PRECONDITION(CheckPointer(pMT)); PRECONDITION(CheckPointer(pTemplateMD)); - PRECONDITION(pMT->IsRestored()); PRECONDITION(pTemplateMD->GetMethodTable()->GetCanonicalMethodTable() == pMT->GetCanonicalMethodTable()); } CONTRACTL_END @@ -731,7 +730,6 @@ MethodDesc::FindOrCreateAssociatedMethodDesc(MethodDesc* pDefMD, PRECONDITION(CheckPointer(pDefMD)); PRECONDITION(CheckPointer(pExactMT)); - PRECONDITION(pExactMT->IsRestored()); // If the method descriptor belongs to a generic type then // the input exact type must be an instantiation of that type. diff --git a/src/coreclr/vm/interpreter.cpp b/src/coreclr/vm/interpreter.cpp index 9f18d7a117c68..96eb63daa071f 100644 --- a/src/coreclr/vm/interpreter.cpp +++ b/src/coreclr/vm/interpreter.cpp @@ -9681,7 +9681,6 @@ void Interpreter::DoCallWork(bool virtualCall, void* thisArg, CORINFO_RESOLVED_T { TypeHandle th = ms.GetLastTypeHandleThrowing(ClassLoader::LoadTypes); CONSISTENCY_CHECK(th.CheckFullyLoaded()); - CONSISTENCY_CHECK(th.IsRestored()); } } } diff --git a/src/coreclr/vm/jithelpers.cpp b/src/coreclr/vm/jithelpers.cpp index d41861f6c3567..6f31284615846 100644 --- a/src/coreclr/vm/jithelpers.cpp +++ b/src/coreclr/vm/jithelpers.cpp @@ -2445,7 +2445,6 @@ HCIMPL1(Object*, JIT_New, CORINFO_CLASS_HANDLE typeHnd_) _ASSERTE(!typeHnd.IsTypeDesc()); // heap objects must have method tables MethodTable *pMT = typeHnd.AsMethodTable(); - _ASSERTE(pMT->IsRestored()); #ifdef _DEBUG if (g_pConfig->FastGCStressLevel()) { @@ -2472,7 +2471,6 @@ HCIMPL1(Object*, JIT_NewMaybeFrozen, CORINFO_CLASS_HANDLE typeHnd_) _ASSERTE(!typeHnd.IsTypeDesc()); // heap objects must have method tables MethodTable* pMT = typeHnd.AsMethodTable(); - _ASSERTE(pMT->IsRestored()); #ifdef _DEBUG if (g_pConfig->FastGCStressLevel()) { @@ -3494,7 +3492,6 @@ HCIMPL2(CORINFO_GENERIC_HANDLE, JIT_GenericHandleClass, CORINFO_CLASS_HANDLE cla CONTRACTL { FCALL_CHECK; PRECONDITION(CheckPointer(classHnd)); - PRECONDITION(TypeHandle(classHnd).IsRestored()); PRECONDITION(CheckPointer(signature)); } CONTRACTL_END; @@ -3514,7 +3511,6 @@ HCIMPL2(CORINFO_GENERIC_HANDLE, JIT_GenericHandleClassWithSlotAndModule, CORINFO CONTRACTL{ FCALL_CHECK; PRECONDITION(CheckPointer(classHnd)); - PRECONDITION(TypeHandle(classHnd).IsRestored()); PRECONDITION(CheckPointer(pArgs)); } CONTRACTL_END; @@ -3536,7 +3532,6 @@ HCIMPL2(CORINFO_GENERIC_HANDLE, JIT_GenericHandleClassLogging, CORINFO_CLASS_HAN CONTRACTL { FCALL_CHECK; PRECONDITION(CheckPointer(classHnd)); - PRECONDITION(TypeHandle(classHnd).IsRestored()); PRECONDITION(CheckPointer(signature)); } CONTRACTL_END; diff --git a/src/coreclr/vm/jitinterface.cpp b/src/coreclr/vm/jitinterface.cpp index cac5999056265..f2f7d229d546f 100644 --- a/src/coreclr/vm/jitinterface.cpp +++ b/src/coreclr/vm/jitinterface.cpp @@ -6594,7 +6594,7 @@ bool CEEInfo::notifyMethodInfoUsage(CORINFO_METHOD_HANDLE ftn) #endif // FEATURE_REJIT EE_TO_JIT_TRANSITION(); - + return true; } @@ -8691,7 +8691,7 @@ bool CEEInfo::resolveVirtualMethodHelper(CORINFO_DEVIRTUALIZATION_INFO * info) TypeHandle ObjClassHnd(info->objClass); MethodTable* pObjMT = ObjClassHnd.GetMethodTable(); - _ASSERTE(pObjMT->IsRestored() && pObjMT->IsFullyLoaded()); + _ASSERTE(pObjMT->IsFullyLoaded()); // Can't devirtualize from __Canon. if (ObjClassHnd == TypeHandle(g_pCanonMethodTableClass)) diff --git a/src/coreclr/vm/methoditer.cpp b/src/coreclr/vm/methoditer.cpp index 82def6a1bec50..409cbb991f259 100644 --- a/src/coreclr/vm/methoditer.cpp +++ b/src/coreclr/vm/methoditer.cpp @@ -94,13 +94,6 @@ BOOL LoadedMethodDescIterator::Next( if (!GetCurrentModule()->GetAvailableParamTypes()->FindNext(&m_typeIterator, &m_typeIteratorEntry)) goto ADVANCE_ASSEMBLY; - //if (m_typeIteratorEntry->data != TypeHandle(m_mainMD->GetMethodTable())) - // goto ADVANCE_TYPE; - - // When looking up the AvailableParamTypes table we have to be really careful since - // the entries may be unrestored, and may have all sorts of encoded tokens in them. - // Similar logic occurs in the Lookup function for that table. We will clean this - // up in Whidbey Beta2. TypeHandle th = m_typeIteratorEntry->GetTypeHandle(); if (th.IsTypeDesc()) @@ -108,9 +101,6 @@ BOOL LoadedMethodDescIterator::Next( MethodTable *pMT = th.AsMethodTable(); - if (!pMT->IsRestored()) - goto ADVANCE_TYPE; - // Check the class token if (pMT->GetTypeDefRid() != m_mainMD->GetMethodTable()->GetTypeDefRid()) goto ADVANCE_TYPE; diff --git a/src/coreclr/vm/methodtable.cpp b/src/coreclr/vm/methodtable.cpp index 503f2711fcb1a..7d16ed26fbbf0 100644 --- a/src/coreclr/vm/methodtable.cpp +++ b/src/coreclr/vm/methodtable.cpp @@ -413,29 +413,6 @@ void MethodTable::SetClassInitError() GetDomainLocalModule()->SetClassInitError(this); } -//========================================================================================== -// mark the class as having been restored. -void MethodTable::SetIsRestored() -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - } - CONTRACTL_END - - PRECONDITION(!IsFullyLoaded()); - - InterlockedAnd((LONG*)&GetAuxiliaryDataForWrite()->m_dwFlags, ~MethodTableAuxiliaryData::enum_flag_Unrestored); - -#ifndef DACCESS_COMPILE - if (ETW_PROVIDER_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER)) - { - ETW::MethodLog::MethodTableRestored(this); - } -#endif -} - //========================================================================================== // mark as COM object type (System.__ComObject and types deriving from it) void MethodTable::SetComObjectType() @@ -515,7 +492,7 @@ BOOL MethodTable::HasSameTypeDefAs(MethodTable *pMT) if (rid != pMT->GetTypeDefRid()) return FALSE; - // Types without RIDs are unrelated to each other. This case is taken for arrays. + // Types without RIDs are unrelated to each other. This case is taken for arrays. if (rid == 0) return FALSE; @@ -711,14 +688,14 @@ void MethodTable::AllocateAuxiliaryData(LoaderAllocator *pAllocator, Module *pLo if (hasGenericStatics) prependedAllocationSpace = prependedAllocationSpace + sizeof(GenericsStaticsInfo); - + cbAuxiliaryData = cbAuxiliaryData + S_SIZE_T(prependedAllocationSpace) + extraAllocation; if (cbAuxiliaryData.IsOverflow()) ThrowHR(COR_E_OVERFLOW); BYTE* pAuxiliaryDataRegion = (BYTE *) pamTracker->Track(pAllocator->GetHighFrequencyHeap()->AllocMem(cbAuxiliaryData)); - + MethodTableAuxiliaryData * pMTAuxiliaryData; pMTAuxiliaryData = (MethodTableAuxiliaryData *)(pAuxiliaryDataRegion + prependedAllocationSpace); @@ -983,7 +960,6 @@ BOOL MethodTable::FindDynamicallyAddedInterface(MethodTable *pInterface) { LIMITED_METHOD_CONTRACT; - _ASSERTE(IsRestored()); _ASSERTE(HasDynamicInterfaceMap()); // This should never be called on for a type that is not an extensible RCW. unsigned cDynInterfaces = GetNumDynamicallyAddedInterfaces(); @@ -1006,7 +982,6 @@ void MethodTable::AddDynamicInterface(MethodTable *pItfMT) THROWS; GC_NOTRIGGER; MODE_ANY; - PRECONDITION(IsRestored()); PRECONDITION(HasDynamicInterfaceMap()); // This should never be called on for a type that is not an extensible RCW. } CONTRACTL_END; @@ -1334,7 +1309,6 @@ BOOL MethodTable::CanCastToInterface(MethodTable *pTargetMT, TypeHandlePairList INSTANCE_CHECK; PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(pTargetMT->IsInterface()); - PRECONDITION(IsRestored()); } CONTRACTL_END @@ -1375,7 +1349,6 @@ BOOL MethodTable::CanCastByVarianceToInterfaceOrDelegate(MethodTable *pTargetMT, PRECONDITION(CheckPointer(pTargetMT)); PRECONDITION(pTargetMT->HasVariance()); PRECONDITION(pTargetMT->IsInterface() || pTargetMT->IsDelegate()); - PRECONDITION(IsRestored()); } CONTRACTL_END @@ -1517,7 +1490,6 @@ BOOL MethodTable::CanCastTo(MethodTable* pTargetMT, TypeHandlePairList* pVisited MODE_COOPERATIVE; INSTANCE_CHECK; PRECONDITION(CheckPointer(pTargetMT)); - PRECONDITION(IsRestored()); } CONTRACTL_END @@ -4850,35 +4822,6 @@ OBJECTREF MethodTable::GetManagedClassObject() #endif //!DACCESS_COMPILE -//========================================================================================== -// This needs to stay consistent with AllocateNewMT() and MethodTable::Save() -// -// protect this via some asserts as we've had one hard-to-track-down -// bug already -// -void MethodTable::GetSavedExtent(TADDR *pStart, TADDR *pEnd) -{ - CONTRACTL - { - NOTHROW; - GC_NOTRIGGER; - } - CONTRACTL_END; - - TADDR start; - - if (ContainsPointers()) - start = dac_cast(this) - CGCDesc::GetCGCDescFromMT(this)->GetSize(); - else - start = dac_cast(this); - - TADDR end = dac_cast(this) + GetEndOffsetOfOptionalMembers(); - - _ASSERTE(start && end && (start < end)); - *pStart = start; - *pEnd = end; -} - //========================================================================================== void MethodTable::CheckRestore() { @@ -5122,7 +5065,6 @@ void MethodTable::DoFullyLoad(Generics::RecursionGraph * const pVisited, const // First ensure that we're loaded to just below CLASS_DEPENDENCIES_LOADED ClassLoader::EnsureLoaded(this, (ClassLoadLevel) (level-1)); - CONSISTENCY_CHECK(IsRestored()); CONSISTENCY_CHECK(!HasApproxParent()); if ((level == CLASS_LOADED) && !IsSharedByGenericInstantiations()) @@ -5613,13 +5555,10 @@ CorElementType MethodTable::GetInternalCorElementType() // DAC may be targeting a dump; dumps do not guarantee you can retrieve the EEClass from // the MethodTable so this is not expected to work in a DAC build. #if defined(_DEBUG) && !defined(DACCESS_COMPILE) - if (IsRestored()) + PTR_EEClass pClass = GetClass(); + if (ret != pClass->GetInternalCorElementType()) { - PTR_EEClass pClass = GetClass(); - if (ret != pClass->GetInternalCorElementType()) - { - _ASSERTE(!"Mismatched results in MethodTable::GetInternalCorElementType"); - } + _ASSERTE(!"Mismatched results in MethodTable::GetInternalCorElementType"); } #endif // defined(_DEBUG) && !defined(DACCESS_COMPILE) return ret; @@ -7198,8 +7137,6 @@ MethodTable * MethodTable::GetMethodTableMatchingParentClass(MethodTable * pWhic NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pWhichParent)); - PRECONDITION(IsRestored()); - PRECONDITION(pWhichParent->IsRestored()); SUPPORTS_DAC; } CONTRACTL_END; @@ -7254,8 +7191,6 @@ Instantiation MethodTable::GetInstantiationOfParentClass(MethodTable *pWhichPare NOTHROW; GC_NOTRIGGER; PRECONDITION(CheckPointer(pWhichParent)); - PRECONDITION(IsRestored()); - PRECONDITION(pWhichParent->IsRestored()); SUPPORTS_DAC; } CONTRACTL_END; diff --git a/src/coreclr/vm/methodtable.h b/src/coreclr/vm/methodtable.h index 1e47529db0388..4a7cfb2232061 100644 --- a/src/coreclr/vm/methodtable.h +++ b/src/coreclr/vm/methodtable.h @@ -312,9 +312,9 @@ struct MethodTableAuxiliaryData enum_flag_CanCompareBitsOrUseFastGetHashCode = 0x0001, // Is any field type or sub field type overrode Equals or GetHashCode enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode = 0x0002, // Whether we have checked the overridden Equals or GetHashCode - enum_flag_Unrestored = 0x0004, + // enum_unused = 0x0004, enum_flag_HasApproxParent = 0x0010, - enum_flag_UnrestoredTypeKey = 0x0020, + // enum_unused = 0x0020, enum_flag_IsNotFullyLoaded = 0x0040, enum_flag_DependenciesLoaded = 0x0080, // class and all dependencies loaded up to CLASS_LOADED_BUT_NOT_VERIFIED @@ -339,7 +339,7 @@ struct MethodTableAuxiliaryData int16_t m_offsetToNonVirtualSlots; }; }; - + PTR_Module m_pLoaderModule; @@ -400,28 +400,14 @@ struct MethodTableAuxiliaryData LIMITED_METHOD_CONTRACT; // Used only during method table initialization - no need for logging or Interlocked Exchange. - m_dwFlags |= (MethodTableAuxiliaryData::enum_flag_UnrestoredTypeKey | - MethodTableAuxiliaryData::enum_flag_Unrestored | - MethodTableAuxiliaryData::enum_flag_IsNotFullyLoaded | + m_dwFlags |= (MethodTableAuxiliaryData::enum_flag_IsNotFullyLoaded | MethodTableAuxiliaryData::enum_flag_HasApproxParent); } - void SetIsRestoredForBuildMethodTable() - { - LIMITED_METHOD_CONTRACT; - - // Used only during method table initialization - no need for logging or Interlocked Exchange. - m_dwFlags &= ~(MethodTableAuxiliaryData::enum_flag_UnrestoredTypeKey | - MethodTableAuxiliaryData::enum_flag_Unrestored); - } - void SetIsRestoredForBuildArrayMethodTable() { LIMITED_METHOD_CONTRACT; - // Used only during method table initialization - no need for logging or Interlocked Exchange. - SetIsRestoredForBuildMethodTable(); - // Array's parent is always precise m_dwFlags &= ~(MethodTableAuxiliaryData::enum_flag_HasApproxParent); @@ -912,41 +898,12 @@ class MethodTable void SetHasClassConstructor(); WORD GetClassConstructorSlot(); - void GetSavedExtent(TADDR *ppStart, TADDR *ppEnd); - - //------------------------------------------------------------------- - // Save/Fixup/Restore/NeedsRestore - // - // Restore this method table if it's not already restored - // This is done by forcing a class load which in turn calls the Restore method - // The pending list is required for restoring types that reference themselves through - // instantiations of the superclass or interfaces e.g. System.Int32 : IComparable - void AllocateRegularStaticBoxes(); void AllocateRegularStaticBox(FieldDesc* pField, Object** boxedStaticHandle); static OBJECTREF AllocateStaticBox(MethodTable* pFieldMT, BOOL fPinned, bool canBeFrozen = false); void CheckRestore(); - inline BOOL HasUnrestoredTypeKey() const - { - LIMITED_METHOD_DAC_CONTRACT; - - return (GetAuxiliaryData()->m_dwFlags & MethodTableAuxiliaryData::enum_flag_UnrestoredTypeKey) != 0; - } - - // Actually do the restore actions on the method table - void Restore(); - - void SetIsRestored(); - - inline BOOL IsRestored() - { - LIMITED_METHOD_DAC_CONTRACT; - - return !(GetAuxiliaryData()->m_dwFlags & MethodTableAuxiliaryData::enum_flag_Unrestored); - } - //------------------------------------------------------------------- // LOAD LEVEL // @@ -970,7 +927,6 @@ class MethodTable CONTRACTL_END; PRECONDITION(!HasApproxParent()); - PRECONDITION(IsRestored()); InterlockedAnd((LONG*)&GetAuxiliaryDataForWrite()->m_dwFlags, ~MethodTableAuxiliaryData::enum_flag_IsNotFullyLoaded); } @@ -1029,7 +985,6 @@ class MethodTable CONTRACTL_END; PRECONDITION(!HasApproxParent()); - PRECONDITION(IsRestored()); InterlockedOr((LONG*)&GetAuxiliaryDataForWrite()->m_dwFlags, MethodTableAuxiliaryData::enum_flag_DependenciesLoaded); } @@ -1042,12 +997,6 @@ class MethodTable if (dwFlags & MethodTableAuxiliaryData::enum_flag_IsNotFullyLoaded) { - if (dwFlags & MethodTableAuxiliaryData::enum_flag_UnrestoredTypeKey) - return CLASS_LOAD_UNRESTOREDTYPEKEY; - - if (dwFlags & MethodTableAuxiliaryData::enum_flag_Unrestored) - return CLASS_LOAD_UNRESTORED; - if (dwFlags & MethodTableAuxiliaryData::enum_flag_HasApproxParent) return CLASS_LOAD_APPROXPARENTS; @@ -2402,7 +2351,7 @@ class MethodTable OBJECTREF Allocate(); // This flavor of Allocate is more efficient, but can only be used - // if IsRestored(), CheckInstanceActivated(), IsClassInited() are known to be true. + // if CheckInstanceActivated(), IsClassInited() are known to be true. // A sufficient condition is that another instance of the exact same type already // exists in the same appdomain. It's currently called only from Delegate.Combine // via COMDelegate::InternalAllocLike. @@ -2924,13 +2873,13 @@ public : static UINT32 GetObjectSize(MethodTable *pMT, MethodDataComputeOptions computeOptions); // Constructor. Make sure you have allocated enough memory using GetObjectSize. - inline MethodDataObject(MethodTable *pMT, MethodDataComputeOptions computeOptions) : + inline MethodDataObject(MethodTable *pMT, MethodDataComputeOptions computeOptions) : MethodData(pMT, pMT), m_numMethods(ComputeNumMethods(pMT, computeOptions)), m_virtualsOnly(computeOptions == MethodDataComputeOptions::NoCacheVirtualsOnly) { WRAPPER_NO_CONTRACT; _ASSERTE(computeOptions != MethodDataComputeOptions::CacheOnly); Init(NULL); } - inline MethodDataObject(MethodTable *pMT, MethodData *pParentData, MethodDataComputeOptions computeOptions) : + inline MethodDataObject(MethodTable *pMT, MethodData *pParentData, MethodDataComputeOptions computeOptions) : MethodData(pMT, pMT), m_numMethods(ComputeNumMethods(pMT, computeOptions)), m_virtualsOnly(computeOptions == MethodDataComputeOptions::NoCacheVirtualsOnly) diff --git a/src/coreclr/vm/methodtable.inl b/src/coreclr/vm/methodtable.inl index 8ca224fcfba7c..a36cc534cd576 100644 --- a/src/coreclr/vm/methodtable.inl +++ b/src/coreclr/vm/methodtable.inl @@ -1229,7 +1229,6 @@ inline OBJECTREF MethodTable::AllocateNoChecks() // we know an instance of this class already exists in the same appdomain // therefore, some checks become redundant. // this currently only happens for Delegate.Combine - CONSISTENCY_CHECK(IsRestored()); CONSISTENCY_CHECK(CheckInstanceActivated()); diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index 53e742176d2c5..829a5ce3b8d69 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -10235,7 +10235,6 @@ void MethodTableBuilder::CheckForSystemTypes() // Helper to create a new method table. This is the only // way to allocate a new MT. Don't try calling new / ctor. // Called from SetupMethodTable -// This needs to be kept consistent with MethodTable::GetSavedExtent() MethodTable * MethodTableBuilder::AllocateNewMT( Module *pLoaderModule, DWORD dwVtableSlots, @@ -10806,10 +10805,6 @@ MethodTableBuilder::SetupMethodTable2( pMT->SetCl(GetCl()); - // The type is sufficiently initialized for most general purpose accessor methods to work. - // Mark the type as restored to avoid avoid asserts. - pMT->GetAuxiliaryDataForWrite()->SetIsRestoredForBuildMethodTable(); - #ifdef _DEBUG // Store status if we tried to inject duplicate interfaces if (bmtInterface->dbg_fShouldInjectInterfaceDuplicates) diff --git a/src/coreclr/vm/object.cpp b/src/coreclr/vm/object.cpp index de15fda59334a..213a9cde5925b 100644 --- a/src/coreclr/vm/object.cpp +++ b/src/coreclr/vm/object.cpp @@ -211,7 +211,6 @@ TypeHandle Object::GetGCSafeTypeHandleIfPossible() const GC_TRIGGERS; INJECT_FAULT(COMPlusThrowOM()); PRECONDITION(CheckPointer(pInterfaceMT)); - PRECONDITION(pObj->GetMethodTable()->IsRestored()); PRECONDITION(pInterfaceMT->IsInterface()); } CONTRACTL_END diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/vm/proftoeeinterfaceimpl.cpp index ae2a45a0e3027..b5cf7dbb63346 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/vm/proftoeeinterfaceimpl.cpp @@ -3078,14 +3078,6 @@ HRESULT ProfToEEInterfaceImpl::GetRVAStaticAddress(ClassID classId, TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // // Get the field descriptor object // @@ -3201,14 +3193,6 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainStaticAddress(ClassID classId, TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // We might have caught a collectible assembly in the middle of being collected Module *pModule = typeHandle.GetModule(); if (pModule->IsCollectible() && @@ -3443,14 +3427,6 @@ HRESULT ProfToEEInterfaceImpl::GetThreadStaticAddress2(ClassID classId, TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // // Get the field descriptor object // @@ -3685,14 +3661,6 @@ HRESULT ProfToEEInterfaceImpl::GetStaticFieldInfo(ClassID classId, TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // // Get the field descriptor object // @@ -3801,14 +3769,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassIDInfo2(ClassID classId, TypeHandle typeHandle = TypeHandle::FromPtr((void *)classId); - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // // Handle globals which don't have the instances. // @@ -4815,29 +4775,18 @@ HRESULT ProfToEEInterfaceImpl::GetClassIDInfo(ClassID classId, { TypeHandle th = TypeHandle::FromPtr((void *)classId); - if (!th.IsTypeDesc()) + if (!th.IsTypeDesc() && !th.IsArray()) { - if (!th.IsArray()) + if (pModuleId != NULL) { - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!th.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - - if (pModuleId != NULL) - { - *pModuleId = (ModuleID) th.GetModule(); - _ASSERTE(*pModuleId != NULL); - } + *pModuleId = (ModuleID) th.GetModule(); + _ASSERTE(*pModuleId != NULL); + } - if (pTypeDefToken != NULL) - { - *pTypeDefToken = th.GetCl(); - _ASSERTE(*pTypeDefToken != NULL); - } + if (pTypeDefToken != NULL) + { + *pTypeDefToken = th.GetCl(); + _ASSERTE(*pTypeDefToken != NULL); } } } @@ -4884,11 +4833,6 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionInfo(FunctionID functionId, MethodDesc *pMDesc = (MethodDesc *) functionId; MethodTable *pMT = pMDesc->GetMethodTable(); - if (!pMT->IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - ClassID classId = PROFILER_GLOBAL_CLASS; if (pMT != NULL) @@ -5494,8 +5438,7 @@ HRESULT ProfToEEInterfaceImpl::GetFunctionFromTokenAndTypeArgs(ModuleID moduleID MethodTable* pMethodTable = typeHandle.GetMethodTable(); - if (pMethodTable == NULL || !pMethodTable->IsRestored() || - pMethodDesc == NULL) + if (pMethodTable == NULL || pMethodDesc == NULL) { return CORPROF_E_DATAINCOMPLETE; } @@ -7959,14 +7902,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassLayout(ClassID classID, return E_INVALIDARG; } - // - // If this class is not fully restored, that is all the information we can get at this time. - // - if (!typeHandle.IsRestored()) - { - return CORPROF_E_DATAINCOMPLETE; - } - // !IsValueType = IsArray || IsReferenceType Since IsArry has been ruled out above, it must // be a reference type if !IsValueType. BOOL fReferenceType = !typeHandle.IsValueType(); @@ -7974,10 +7909,6 @@ HRESULT ProfToEEInterfaceImpl::GetClassLayout(ClassID classID, // // Fill in class size now // - // Move after the check for typeHandle.GetMethodTable()->IsRestored() - // because an unrestored MethodTable may have a bad EE class pointer - // which will be used by MethodTable::GetNumInstanceFieldBytes - // if (pulClassSize != NULL) { if (fReferenceType) @@ -8078,7 +8009,7 @@ StackWalkAction ProfilerStackWalkCallback(CrawlFrame *pCf, PROFILER_STACK_WALK_D // Skip all managed exception handling functions // if (pFunc != NULL && ( - (pFunc->GetMethodTable() == g_pEHClass) || + (pFunc->GetMethodTable() == g_pEHClass) || (pFunc->GetMethodTable() == g_pExceptionServicesInternalCallsClass) || (pFunc->GetMethodTable() == g_pStackFrameIteratorClass))) { diff --git a/src/coreclr/vm/proftoeeinterfaceimpl.inl b/src/coreclr/vm/proftoeeinterfaceimpl.inl index 18404dfe91920..524900c7182e0 100644 --- a/src/coreclr/vm/proftoeeinterfaceimpl.inl +++ b/src/coreclr/vm/proftoeeinterfaceimpl.inl @@ -180,8 +180,7 @@ inline BOOL IsClassOfMethodTableInited(MethodTable * pMethodTable) { LIMITED_METHOD_CONTRACT; - return (pMethodTable->IsRestored() && - (pMethodTable->GetModuleForStatics() != NULL) && + return ((pMethodTable->GetModuleForStatics() != NULL) && (pMethodTable->GetDomainLocalModule() != NULL) && pMethodTable->IsClassInited()); } diff --git a/src/coreclr/vm/siginfo.cpp b/src/coreclr/vm/siginfo.cpp index eb35f3a372538..719073867caa6 100644 --- a/src/coreclr/vm/siginfo.cpp +++ b/src/coreclr/vm/siginfo.cpp @@ -1988,9 +1988,6 @@ TypeHandle SigPointer::GetTypeVariable(CorElementType et, GC_NOTRIGGER; POSTCONDITION(CheckPointer(RETVAL, NULL_OK)); // will return TypeHandle() if index is out of range SUPPORTS_DAC; -#ifndef DACCESS_COMPILE - // POSTCONDITION(RETVAL.IsNull() || RETVAL.IsRestored() || RETVAL.GetMethodTable()->IsRestoring()); -#endif MODE_ANY; } CONTRACT_END diff --git a/src/coreclr/vm/typedesc.cpp b/src/coreclr/vm/typedesc.cpp index 95e86ccc96169..2c43168f3aed2 100644 --- a/src/coreclr/vm/typedesc.cpp +++ b/src/coreclr/vm/typedesc.cpp @@ -573,17 +573,6 @@ OBJECTREF FnPtrTypeDesc::GetManagedClassObject() #endif // #ifndef DACCESS_COMPILE -BOOL TypeDesc::IsRestored() -{ - STATIC_CONTRACT_NOTHROW; - STATIC_CONTRACT_GC_NOTRIGGER; - STATIC_CONTRACT_FORBID_FAULT; - STATIC_CONTRACT_CANNOT_TAKE_LOCK; - SUPPORTS_DAC; - - return (m_typeAndFlags & TypeDesc::enum_flag_Unrestored) == 0; -} - ClassLoadLevel TypeDesc::GetLoadLevel() { STATIC_CONTRACT_NOTHROW; @@ -591,15 +580,7 @@ ClassLoadLevel TypeDesc::GetLoadLevel() STATIC_CONTRACT_FORBID_FAULT; SUPPORTS_DAC; - if (m_typeAndFlags & TypeDesc::enum_flag_UnrestoredTypeKey) - { - return CLASS_LOAD_UNRESTOREDTYPEKEY; - } - else if (m_typeAndFlags & TypeDesc::enum_flag_Unrestored) - { - return CLASS_LOAD_UNRESTORED; - } - else if (m_typeAndFlags & TypeDesc::enum_flag_IsNotFullyLoaded) + if (m_typeAndFlags & TypeDesc::enum_flag_IsNotFullyLoaded) { if (m_typeAndFlags & TypeDesc::enum_flag_DependenciesLoaded) { diff --git a/src/coreclr/vm/typedesc.h b/src/coreclr/vm/typedesc.h index b86845c81e21c..e78f20aaba31c 100644 --- a/src/coreclr/vm/typedesc.h +++ b/src/coreclr/vm/typedesc.h @@ -112,18 +112,6 @@ class TypeDesc // Is actually ParamTypeDesc (BYREF, PTR) BOOL HasTypeParam(); - void DoRestoreTypeKey(); - void Restore(); - BOOL IsRestored(); - void SetIsRestored(); - - inline BOOL HasUnrestoredTypeKey() const - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - - return (m_typeAndFlags & TypeDesc::enum_flag_UnrestoredTypeKey) != 0; - } BOOL HasTypeEquivalence() const { @@ -190,8 +178,8 @@ class TypeDesc { // unused = 0x00000100, // unused = 0x00000200, - enum_flag_Unrestored = 0x00000400, - enum_flag_UnrestoredTypeKey = 0x00000800, + // unused = 0x00000400, + // unused = 0x00000800, enum_flag_IsNotFullyLoaded = 0x00001000, enum_flag_DependenciesLoaded = 0x00002000, enum_flag_HasTypeEquivalence = 0x00004000 @@ -303,7 +291,7 @@ class ParamTypeDesc : public TypeDesc { // the m_typeAndFlags field in TypeDesc tell what kind of parameterized type we have // The type that is being modified - TypeHandle m_Arg; + TypeHandle m_Arg; // Non-unloadable context: internal RuntimeType object handle // Unloadable context: slot index in LoaderAllocator's pinned table @@ -460,7 +448,7 @@ class TypeVarTypeDesc : public TypeDesc // Constraints, determined on first call to GetConstraints Volatile m_numConstraints; // -1 until number has been determined PTR_TypeHandle m_constraints; - + // Non-unloadable context: internal RuntimeType object handle // Unloadable context: slot index in LoaderAllocator's pinned table RUNTIMETYPEHANDLE m_hExposedClassObject; diff --git a/src/coreclr/vm/typehandle.cpp b/src/coreclr/vm/typehandle.cpp index 053cc759217c7..e88104667f652 100644 --- a/src/coreclr/vm/typehandle.cpp +++ b/src/coreclr/vm/typehandle.cpp @@ -31,9 +31,6 @@ BOOL TypeHandle::Verify() if (IsNull()) return(TRUE); - if (!IsRestored()) - return TRUE; - if (IsArray()) { GetArrayElementTypeHandle().Verify(); @@ -1014,31 +1011,6 @@ BOOL TypeHandle::IsFnPtrType() const (GetSignatureCorElementType() == ELEMENT_TYPE_FNPTR)); } -BOOL TypeHandle::IsRestored() const -{ - LIMITED_METHOD_DAC_CONTRACT; - - if (!IsTypeDesc()) - { - return AsMethodTable()->IsRestored(); - } - else - { - return AsTypeDesc()->IsRestored(); - } -} - -BOOL TypeHandle::HasUnrestoredTypeKey() const -{ - WRAPPER_NO_CONTRACT; - SUPPORTS_DAC; - - if (IsTypeDesc()) - return AsTypeDesc()->HasUnrestoredTypeKey(); - else - return AsMethodTable()->HasUnrestoredTypeKey(); -} - void TypeHandle::CheckRestore() const { CONTRACTL @@ -1587,8 +1559,6 @@ CHECK TypeHandle::CheckMatchesKey(TypeKey *pKey) const const char * const classLoadLevelName[] = { "BEGIN", - "UNRESTOREDTYPEKEY", - "UNRESTORED", "APPROXPARENTS", "EXACTPARENTS", "DEPENDENCIES_LOADED", @@ -1614,8 +1584,6 @@ CHECK TypeHandle::CheckLoadLevel(ClassLoadLevel requiredLevel) // ("Type has not been sufficiently loaded (actual level is %d, required level is %d)", // /* debugTypeName.GetUnicode(), */ actualLevel, requiredLevel /* classLoadLevelName[actualLevel], classLoadLevelName[requiredLevel] */)); } - CONSISTENCY_CHECK((actualLevel > CLASS_LOAD_UNRESTORED) == IsRestored()); - CONSISTENCY_CHECK((actualLevel == CLASS_LOAD_UNRESTOREDTYPEKEY) == HasUnrestoredTypeKey()); CHECK_OK; } diff --git a/src/coreclr/vm/typehandle.h b/src/coreclr/vm/typehandle.h index 8e2287eb9d3f2..78212b9e7f8bd 100644 --- a/src/coreclr/vm/typehandle.h +++ b/src/coreclr/vm/typehandle.h @@ -494,13 +494,6 @@ class TypeHandle // Is type that has a type parameter (ARRAY, SZARRAY, BYREF, PTR) BOOL HasTypeParam() const; - BOOL IsRestored() const; - - // Does this type have zap-encoded components (generic arguments, etc)? - BOOL HasUnrestoredTypeKey() const; - - void DoRestoreTypeKey(); - void CheckRestore() const; BOOL IsExternallyVisible() const; diff --git a/src/coreclr/vm/typehash.cpp b/src/coreclr/vm/typehash.cpp index dfc355c3fafba..c86c8ae5c8c64 100644 --- a/src/coreclr/vm/typehash.cpp +++ b/src/coreclr/vm/typehash.cpp @@ -337,26 +337,6 @@ EETypeHashEntry_t *EETypeHashTable::FindItem(TypeKey* pKey) pSearch != NULL; pSearch = BaseFindNextEntryByHash(&sContext)) { - if (!pSearch->GetTypeHandle().IsRestored()) - { - // workaround: If we encounter an unrestored MethodTable, then it - // isn't the type for which we are looking (plus, it will crash - // in GetSignatureCorElementType). However TypeDescs can be - // accessed when unrestored. Also they are accessed in that - // manner at startup when we're loading the global types - // (i.e. System.Object). - - if (!pSearch->GetTypeHandle().IsTypeDesc()) - { - // Not a match - continue; - } - else - { - // We have an unrestored TypeDesc - } - } - if (pSearch->GetTypeHandle().GetSignatureCorElementType() != kind) continue; diff --git a/src/coreclr/vm/versionresilienthashcode.cpp b/src/coreclr/vm/versionresilienthashcode.cpp index 85bd146d8dc46..cc4f8d188d165 100644 --- a/src/coreclr/vm/versionresilienthashcode.cpp +++ b/src/coreclr/vm/versionresilienthashcode.cpp @@ -127,7 +127,7 @@ int GetVersionResilientTypeHashCode(TypeHandle type) IfFailThrow(pMT->GetMDImport()->GetNameOfTypeDef(pMT->GetCl(), &szName, &szNamespace)); int hashcode = ComputeNameHashCode(szNamespace, szName); - MethodTable *pMTEnclosing = pMT->LoadEnclosingMethodTable(CLASS_LOAD_UNRESTOREDTYPEKEY); + MethodTable *pMTEnclosing = pMT->LoadEnclosingMethodTable(CLASS_LOAD_APPROXPARENTS); if (pMTEnclosing != NULL) { hashcode = ComputeNestedTypeHashCode(GetVersionResilientTypeHashCode(TypeHandle(pMTEnclosing)), hashcode); diff --git a/src/coreclr/vm/zapsig.cpp b/src/coreclr/vm/zapsig.cpp index 23d807bb28f4c..f0904e6452d0e 100644 --- a/src/coreclr/vm/zapsig.cpp +++ b/src/coreclr/vm/zapsig.cpp @@ -140,7 +140,6 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, PRECONDITION(CheckPointer(handle)); PRECONDITION(CheckPointer(this->context.pInfoModule)); - PRECONDITION(!handle.HasUnrestoredTypeKey()); MODE_ANY; } CONTRACTL_END @@ -303,7 +302,6 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, PRECONDITION(CheckPointer(pZapSigContext->pInfoModule)); PRECONDITION(CheckPointer(handle)); PRECONDITION(CheckPointer(pSig)); - PRECONDITION(!handle.HasUnrestoredTypeKey()); } CONTRACT_END