From da6498e6c1013dd38d33e782bc777bd89aa0f0ee Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 5 Oct 2018 03:08:51 +0200 Subject: Remove context statics stuff (#20256) * Remove context statics stuff part 1 This change removes all context statics stuff from the runtime since context statics are not supported and this code was obsolete. * Remove context statics stuff from the debugger code --- src/ToolBox/SOS/Strike/strike.cpp | 8 ---- src/ToolBox/SOS/Strike/util.cpp | 65 +------------------------------ src/debug/daccess/dacdbiimpl.cpp | 6 +-- src/debug/di/rsclass.cpp | 6 +-- src/debug/inc/dacdbistructures.h | 1 - src/debug/inc/dacdbistructures.inl | 8 +--- src/dlls/mscorrc/mscorrc.rc | 1 - src/dlls/mscorrc/resource.h | 1 - src/vm/appdomain.cpp | 24 ------------ src/vm/appdomain.hpp | 7 ---- src/vm/array.cpp | 1 - src/vm/class.cpp | 4 +- src/vm/classnames.h | 1 - src/vm/field.cpp | 6 +-- src/vm/field.h | 8 ---- src/vm/generics.cpp | 6 --- src/vm/jitinterface.cpp | 8 ---- src/vm/methodtable.h | 10 ----- src/vm/methodtable.inl | 3 -- src/vm/methodtablebuilder.cpp | 28 ++++---------- src/vm/methodtablebuilder.h | 18 +-------- src/vm/object.h | 79 -------------------------------------- src/vm/prestub.cpp | 2 +- src/vm/proftoeeinterfaceimpl.cpp | 14 ++----- 24 files changed, 24 insertions(+), 291 deletions(-) (limited to 'src') diff --git a/src/ToolBox/SOS/Strike/strike.cpp b/src/ToolBox/SOS/Strike/strike.cpp index 70e60312f2..65e2aaf3ba 100644 --- a/src/ToolBox/SOS/Strike/strike.cpp +++ b/src/ToolBox/SOS/Strike/strike.cpp @@ -1258,14 +1258,6 @@ DECLARE_API(DumpClass) ExtOut("NumThreadStaticFields: %x\n", vMethodTableFields.wNumThreadStaticFields); } - - if (vMethodTableFields.wContextStaticsSize) - { - ExtOut("ContextStaticOffset: %x\n", vMethodTableFields.wContextStaticOffset); - ExtOut("ContextStaticsSize: %x\n", vMethodTableFields.wContextStaticsSize); - } - - if (vMethodTableFields.wNumInstanceFields + vMethodTableFields.wNumStaticFields > 0) { DisplayFields(methodTable, &mtdata, &vMethodTableFields, NULL, TRUE, FALSE); diff --git a/src/ToolBox/SOS/Strike/util.cpp b/src/ToolBox/SOS/Strike/util.cpp index db461bae69..9e124c4849 100644 --- a/src/ToolBox/SOS/Strike/util.cpp +++ b/src/ToolBox/SOS/Strike/util.cpp @@ -1405,61 +1405,6 @@ void DisplayThreadStatic (DacpModuleData* pModule, DacpMethodTableData* pMT, Dac ExtOut(" <<\n"); } -void DisplayContextStatic (DacpFieldDescData *pFD, size_t offset, BOOL fIsShared) -{ - ExtOut("\nDisplay of context static variables is not implemented yet\n"); - /* - int numDomain; - DWORD_PTR *domainList = NULL; - GetDomainList (domainList, numDomain); - ToDestroy des0 ((void**)&domainList); - AppDomain vAppDomain; - Context vContext; - - ExtOut(" >> Domain:Value"); - for (int i = 0; i < numDomain; i ++) - { - DWORD_PTR dwAddr = domainList[i]; - if (dwAddr == 0) { - continue; - } - vAppDomain.Fill (dwAddr); - if (vAppDomain.m_pDefaultContext == 0) - continue; - dwAddr = (DWORD_PTR)vAppDomain.m_pDefaultContext; - vContext.Fill (dwAddr); - - if (fIsShared) - dwAddr = (DWORD_PTR)vContext.m_pSharedStaticData; - else - dwAddr = (DWORD_PTR)vContext.m_pUnsharedStaticData; - if (dwAddr == 0) - continue; - dwAddr += offsetof(STATIC_DATA, dataPtr); - dwAddr += offset; - if (safemove (dwAddr, dwAddr) == 0) - continue; - if (dwAddr == 0) - // We have not initialized this yet. - continue; - - dwAddr += pFD->dwOffset; - if (pFD->Type == ELEMENT_TYPE_CLASS - || pFD->Type == ELEMENT_TYPE_VALUETYPE) - { - if (safemove (dwAddr, dwAddr) == 0) - continue; - } - if (dwAddr == 0) - // We have not initialized this yet. - continue; - ExtOut(" %p:", (ULONG64)domainList[i]); - DisplayDataMember (pFD, dwAddr, FALSE); - } - ExtOut(" <<\n"); - */ -} - const char * ElementTypeName(unsigned type) { switch (type) { @@ -1610,7 +1555,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT dwAddr = vFieldDesc.NextField; DWORD offset = vFieldDesc.dwOffset; - if(!((vFieldDesc.bIsThreadLocal || vFieldDesc.bIsContextLocal || fIsShared) && vFieldDesc.bIsStatic)) + if(!((vFieldDesc.bIsThreadLocal || fIsShared) && vFieldDesc.bIsStatic)) { if (!bValueClass) { @@ -1649,7 +1594,7 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT ExtOut("%2s ", (IsElementValueType(vFieldDesc.Type)) ? "1" : "0"); - if (vFieldDesc.bIsStatic && (vFieldDesc.bIsThreadLocal || vFieldDesc.bIsContextLocal)) + if (vFieldDesc.bIsStatic && vFieldDesc.bIsThreadLocal) { numStaticFields ++; if (fIsShared) @@ -1674,12 +1619,6 @@ void DisplayFields(CLRDATA_ADDRESS cdaMT, DacpMethodTableData *pMTD, DacpMethodT DisplayThreadStatic(&vModule, pMTD, &vFieldDesc, fIsShared); } } - else if (vFieldDesc.bIsContextLocal) - { - DisplayContextStatic(&vFieldDesc, - pMTFD->wContextStaticOffset, - fIsShared); - } } } diff --git a/src/debug/daccess/dacdbiimpl.cpp b/src/debug/daccess/dacdbiimpl.cpp index 57f9f6be39..2ce8c72621 100644 --- a/src/debug/daccess/dacdbiimpl.cpp +++ b/src/debug/daccess/dacdbiimpl.cpp @@ -1625,7 +1625,6 @@ void DacDbiInterfaceImpl::ComputeFieldData(PTR_FieldDesc pFD, pCurrentFieldData->m_vmFieldDesc.SetHostPtr(pFD); pCurrentFieldData->m_fFldStorageAvailable = FALSE; pCurrentFieldData->m_fFldIsTLS = FALSE; - pCurrentFieldData->m_fFldIsContextStatic = FALSE; pCurrentFieldData->m_fFldIsRVA = FALSE; pCurrentFieldData->m_fFldIsCollectibleStatic = FALSE; } @@ -1638,7 +1637,6 @@ void DacDbiInterfaceImpl::ComputeFieldData(PTR_FieldDesc pFD, // completely DACized pCurrentFieldData->m_vmFieldDesc.SetHostPtr(pFD); pCurrentFieldData->m_fFldIsTLS = (pFD->IsThreadStatic() == TRUE); - pCurrentFieldData->m_fFldIsContextStatic = (pFD->IsContextStatic() == TRUE); pCurrentFieldData->m_fFldIsRVA = (pFD->IsRVA() == TRUE); pCurrentFieldData->m_fFldIsCollectibleStatic = (pFD->IsStatic() == TRUE && pFD->GetEnclosingMethodTable()->Collectible()); @@ -1657,7 +1655,7 @@ void DacDbiInterfaceImpl::ComputeFieldData(PTR_FieldDesc pFD, pCurrentFieldData->SetStaticAddress(PTR_TO_TADDR(addr)); } } - else if (pFD->IsThreadStatic() || pFD->IsContextStatic() || + else if (pFD->IsThreadStatic() || pCurrentFieldData->m_fFldIsCollectibleStatic) { // this is a special type of static that must be queried using DB_IPCE_GET_SPECIAL_STATIC @@ -3831,14 +3829,12 @@ void DacDbiInterfaceImpl::InitFieldData(const FieldDesc * pFD, pFieldData->m_fFldIsTLS = (pFD->IsThreadStatic() == TRUE); pFieldData->m_fldMetadataToken = pFD->GetMemberDef(); pFieldData->m_fFldIsRVA = (pFD->IsRVA() == TRUE); - pFieldData->m_fFldIsContextStatic = (pFD->IsContextStatic() == TRUE); pFieldData->m_fFldIsCollectibleStatic = FALSE; pFieldData->m_fFldStorageAvailable = true; if (pFieldData->m_fFldIsStatic) { //EnC is only supported on regular static fields - _ASSERTE(!pFieldData->m_fFldIsContextStatic); _ASSERTE(!pFieldData->m_fFldIsTLS); _ASSERTE(!pFieldData->m_fFldIsRVA); diff --git a/src/debug/di/rsclass.cpp b/src/debug/di/rsclass.cpp index ff8246685c..99fac5ef4f 100644 --- a/src/debug/di/rsclass.cpp +++ b/src/debug/di/rsclass.cpp @@ -253,7 +253,7 @@ HRESULT CordbClass::GetStaticFieldValue2(CordbModule * pModule, return hr; } } - else if (!pFieldData->m_fFldIsTLS && !pFieldData->m_fFldIsContextStatic) + else if (!pFieldData->m_fFldIsTLS) { // Statics never move, so we always address them using their absolute address. _ASSERTE(pFieldData->OkToGetOrSetStaticAddress()); @@ -269,7 +269,6 @@ HRESULT CordbClass::GetStaticFieldValue2(CordbModule * pModule, // Thread-local and context-local statics cannot be added with EnC, so we shouldn't be here // if this is an EnC field is thread- or context-local. _ASSERTE(!pFieldData->m_fFldIsTLS ); - _ASSERTE(!pFieldData->m_fFldIsContextStatic ); } else { @@ -331,8 +330,7 @@ HRESULT CordbClass::GetStaticFieldValue2(CordbModule * pModule, bool fIsBoxed = (fIsValueClass && !pFieldData->m_fFldIsRVA && !pFieldData->m_fFldIsPrimitive && - !pFieldData->m_fFldIsTLS && - !pFieldData->m_fFldIsContextStatic); + !pFieldData->m_fFldIsTLS); TargetBuffer remoteValue(pRmtStaticValue, CordbValue::GetSizeForType(pType, fIsBoxed ? kBoxed : kUnboxed)); ICorDebugValue * pValue; diff --git a/src/debug/inc/dacdbistructures.h b/src/debug/inc/dacdbistructures.h index a8ff06745b..fc894f3834 100644 --- a/src/debug/inc/dacdbistructures.h +++ b/src/debug/inc/dacdbistructures.h @@ -573,7 +573,6 @@ public: bool m_fFldIsStatic; // true if static field, false if instance field bool m_fFldIsRVA; // true if static relative to module address bool m_fFldIsTLS; // true if thread-specific static - bool m_fFldIsContextStatic; // true if context-specific static bool m_fFldIsPrimitive; // Only true if this is a value type masquerading as a primitive. bool m_fFldIsCollectibleStatic; // true if this is a static field on a collectible type diff --git a/src/debug/inc/dacdbistructures.inl b/src/debug/inc/dacdbistructures.inl index 48749135f0..58166c1017 100644 --- a/src/debug/inc/dacdbistructures.inl +++ b/src/debug/inc/dacdbistructures.inl @@ -646,7 +646,7 @@ typedef ULONG_PTR SIZE_T; inline BOOL FieldData::OkToGetOrSetInstanceOffset() { - return (!m_fFldIsStatic && !m_fFldIsRVA && !m_fFldIsTLS && !m_fFldIsContextStatic && + return (!m_fFldIsStatic && !m_fFldIsRVA && !m_fFldIsTLS && m_fFldStorageAvailable && (m_pFldStaticAddress == NULL)); } @@ -657,7 +657,6 @@ void FieldData::SetInstanceOffset(SIZE_T offset) _ASSERTE(!m_fFldIsStatic); _ASSERTE(!m_fFldIsRVA); _ASSERTE(!m_fFldIsTLS); - _ASSERTE(!m_fFldIsContextStatic); _ASSERTE(m_fFldStorageAvailable); _ASSERTE(m_pFldStaticAddress == NULL); m_fldInstanceOffset = offset; @@ -666,7 +665,7 @@ void FieldData::SetInstanceOffset(SIZE_T offset) inline BOOL FieldData::OkToGetOrSetStaticAddress() { - return (m_fFldIsStatic && !m_fFldIsTLS && !m_fFldIsContextStatic && + return (m_fFldIsStatic && !m_fFldIsTLS && m_fFldStorageAvailable && (m_fldInstanceOffset == 0)); } @@ -676,7 +675,6 @@ void FieldData::SetStaticAddress(TADDR addr) { _ASSERTE(m_fFldIsStatic); _ASSERTE(!m_fFldIsTLS); - _ASSERTE(!m_fFldIsContextStatic); _ASSERTE(m_fFldStorageAvailable); _ASSERTE(m_fldInstanceOffset == 0); m_pFldStaticAddress = TADDR(addr); @@ -689,7 +687,6 @@ SIZE_T FieldData::GetInstanceOffset() _ASSERTE(!m_fFldIsStatic); _ASSERTE(!m_fFldIsRVA); _ASSERTE(!m_fFldIsTLS); - _ASSERTE(!m_fFldIsContextStatic); _ASSERTE(m_fFldStorageAvailable); _ASSERTE(m_pFldStaticAddress == NULL); return m_fldInstanceOffset; @@ -701,7 +698,6 @@ TADDR FieldData::GetStaticAddress() { _ASSERTE(m_fFldIsStatic); _ASSERTE(!m_fFldIsTLS); - _ASSERTE(!m_fFldIsContextStatic); _ASSERTE(m_fFldStorageAvailable || (m_pFldStaticAddress == NULL)); _ASSERTE(m_fldInstanceOffset == 0); return m_pFldStaticAddress; diff --git a/src/dlls/mscorrc/mscorrc.rc b/src/dlls/mscorrc/mscorrc.rc index 713d7e0a66..050b260e3b 100644 --- a/src/dlls/mscorrc/mscorrc.rc +++ b/src/dlls/mscorrc/mscorrc.rc @@ -726,7 +726,6 @@ BEGIN IDS_CLASSLOAD_STATICVIRTUAL "Method '%3' in type '%1' from assembly '%2' cannot be a static and a virtual." IDS_CLASSLOAD_REDUCEACCESS "Derived method '%3' in type '%1' from assembly '%2' cannot reduce access." IDS_CLASSLOAD_BADPINVOKE "Could not get PINVOKE information for method '%3' in type '%1' from assembly '%2'." - IDS_CLASSLOAD_COLLECTIBLESPECIALSTATICS "Collectible type '%1' may not have Thread or Context static members." IDS_CLASSLOAD_VALUECLASSTOOLARGE "Array of type '%1' from assembly '%2' cannot be created because base value type is too large." IDS_CLASSLOAD_NOTIMPLEMENTED "Method '%3' in type '%1' from assembly '%2' does not have an implementation." diff --git a/src/dlls/mscorrc/resource.h b/src/dlls/mscorrc/resource.h index 0a42dad28e..189948a37f 100644 --- a/src/dlls/mscorrc/resource.h +++ b/src/dlls/mscorrc/resource.h @@ -233,7 +233,6 @@ #define IDS_CLASSLOAD_MI_MISSING_SIG_DECL 0x17a7 #define IDS_CLASSLOAD_TOOMANYGENERICARGS 0x17ab -#define IDS_CLASSLOAD_COLLECTIBLESPECIALSTATICS 0x17ad #define IDS_COMPLUS_ERROR 0x17ae #define IDS_FATAL_ERROR 0x17af #define IDS_ERROR 0x17b0 diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index 8f8efcf0fc..61f709a9ca 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -726,7 +726,6 @@ BaseDomain::BaseDomain() m_pMarshalingData = NULL; - m_dwContextStatics = 0; #ifdef FEATURE_COMINTEROP m_pMngStdInterfacesInfo = NULL; m_pWinRtBinder = NULL; @@ -973,29 +972,6 @@ void BaseDomain::InitVSD() #ifndef CROSSGEN_COMPILE -DWORD BaseDomain::AllocateContextStaticsOffset(DWORD* pOffsetSlot) -{ - CONTRACTL - { - THROWS; - GC_TRIGGERS; - } - CONTRACTL_END; - - CrstHolder ch(&m_SpecialStaticsCrst); - - DWORD dwOffset = *pOffsetSlot; - - if (dwOffset == (DWORD)-1) - { - // Allocate the slot - dwOffset = m_dwContextStatics++; - *pOffsetSlot = dwOffset; - } - - return dwOffset; -} - void BaseDomain::ClearFusionContext() { CONTRACTL diff --git a/src/vm/appdomain.hpp b/src/vm/appdomain.hpp index 5ffc1b2045..6ba9ff4774 100644 --- a/src/vm/appdomain.hpp +++ b/src/vm/appdomain.hpp @@ -1431,16 +1431,9 @@ protected: PTR_CLRPrivBinderWinRT m_pWinRtBinder; #endif // FEATURE_COMINTEROP - // Number of allocated slots for context local statics of this domain - DWORD m_dwContextStatics; - // Protects allocation of slot IDs for thread and context statics static CrstStatic m_SpecialStaticsCrst; -public: - // Lazily allocate offset for context static - DWORD AllocateContextStaticsOffset(DWORD* pOffsetSlot); - public: // Only call this routine when you can guarantee there are no // loads in progress. diff --git a/src/vm/array.cpp b/src/vm/array.cpp index 5103e9efc0..e41573c497 100644 --- a/src/vm/array.cpp +++ b/src/vm/array.cpp @@ -348,7 +348,6 @@ MethodTable* Module::CreateArrayMethodTable(TypeHandle elemTypeHnd, CorElementTy FALSE, // CCWTemplate FALSE, // RCWPerTypeData FALSE, // RemotingVtsInfo - FALSE, // ContextStatic FALSE); // TokenOverflow // This is the offset of the beginning of the interface map diff --git a/src/vm/class.cpp b/src/vm/class.cpp index fe7fe7e8a7..08d0015424 100644 --- a/src/vm/class.cpp +++ b/src/vm/class.cpp @@ -384,8 +384,7 @@ VOID EEClass::FixupFieldDescForEnC(MethodTable * pMT, EnCFieldDesc *pFD, mdField NULL, NULL, &genericsInfo, - &bmtEnumFields, - NULL); + &bmtEnumFields); EX_TRY { @@ -400,7 +399,6 @@ VOID EEClass::FixupFieldDescForEnC(MethodTable * pMT, EnCFieldDesc *pFD, mdField &pByValueClassCache, &bmtMFDescs, &bmtFP, - NULL, // not needed as thread or context static are not allowed in EnC &totalDeclaredFieldSize); } EX_CATCH_THROWABLE(&pThrowable); diff --git a/src/vm/classnames.h b/src/vm/classnames.h index fec3052326..1c1c545451 100644 --- a/src/vm/classnames.h +++ b/src/vm/classnames.h @@ -96,7 +96,6 @@ #define g_MarshalByRefObjectClassName "System.MarshalByRefObject" #define g_ThreadStaticAttributeClassName "System.ThreadStaticAttribute" -#define g_ContextStaticAttributeClassName "System.ContextStaticAttribute" #define g_StringFreezingAttributeClassName "System.Runtime.CompilerServices.StringFreezingAttribute" #define g_TypeIdentifierAttributeClassName "System.Runtime.InteropServices.TypeIdentifierAttribute" diff --git a/src/vm/field.cpp b/src/vm/field.cpp index 78cb7f5bd0..4c4d89a670 100644 --- a/src/vm/field.cpp +++ b/src/vm/field.cpp @@ -20,7 +20,7 @@ #include "peimagelayout.inl" // called from code:MethodTableBuilder::InitializeFieldDescs#InitCall -VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttrs, BOOL fIsStatic, BOOL fIsRVA, BOOL fIsThreadLocal, BOOL fIsContextLocal, LPCSTR pszFieldName) +VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttrs, BOOL fIsStatic, BOOL fIsRVA, BOOL fIsThreadLocal, LPCSTR pszFieldName) { LIMITED_METHOD_CONTRACT; @@ -46,8 +46,8 @@ VOID FieldDesc::Init(mdFieldDef mb, CorElementType FieldType, DWORD dwMemberAttr FieldType == ELEMENT_TYPE_PTR || FieldType == ELEMENT_TYPE_FNPTR ); - _ASSERTE(fIsStatic || (!fIsRVA && !fIsThreadLocal && !fIsContextLocal)); - _ASSERTE(fIsRVA + fIsThreadLocal + fIsContextLocal <= 1); + _ASSERTE(fIsStatic || (!fIsRVA && !fIsThreadLocal)); + _ASSERTE(fIsRVA + fIsThreadLocal <= 1); m_requiresFullMbValue = 0; SetMemberDef(mb); diff --git a/src/vm/field.h b/src/vm/field.h index 4962fce618..a09b4050fa 100644 --- a/src/vm/field.h +++ b/src/vm/field.h @@ -133,7 +133,6 @@ public: BOOL fIsStatic, BOOL fIsRVA, BOOL fIsThreadLocal, - BOOL fIsContextLocal, LPCSTR pszFieldName); enum { @@ -322,13 +321,6 @@ public: return m_isThreadLocal; } - BOOL IsContextStatic() const // Static relative to a context - { - LIMITED_METHOD_DAC_CONTRACT; - - return FALSE; - } - // Indicate that this field was added by EnC // Must only be called on instances of EnCFieldDesc void SetEnCNew() diff --git a/src/vm/generics.cpp b/src/vm/generics.cpp index a92177d9d0..26cd8a5356 100644 --- a/src/vm/generics.cpp +++ b/src/vm/generics.cpp @@ -225,7 +225,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // These are all copied across from the old MT, i.e. don't depend on the // instantiation. BOOL fHasRemotingVtsInfo = FALSE; - BOOL fHasContextStatics = FALSE; BOOL fHasGenericsStaticsInfo = pOldMT->HasGenericsStaticsInfo(); #ifdef FEATURE_COMINTEROP @@ -239,10 +238,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( // Collectible types have some special restrictions if (pAllocator->IsCollectible()) { - if (fHasContextStatics) - { - ClassLoader::ThrowTypeLoadException(pTypeKey, IDS_CLASSLOAD_COLLECTIBLESPECIALSTATICS); - } if (pOldMT->HasFixedAddressVTStatics()) { ClassLoader::ThrowTypeLoadException(pTypeKey, IDS_CLASSLOAD_COLLECTIBLEFIXEDVTATTR); @@ -289,7 +284,6 @@ ClassLoader::CreateTypeHandleForNonCanonicalGenericInstantiation( fHasCCWTemplate, fHasRCWPerTypeData, fHasRemotingVtsInfo, - fHasContextStatics, pOldMT->HasTokenOverflow()); // We need space for the PerInstInfo, i.e. the generic dictionary pointers... diff --git a/src/vm/jitinterface.cpp b/src/vm/jitinterface.cpp index 28e17e9e3e..293bab97d9 100644 --- a/src/vm/jitinterface.cpp +++ b/src/vm/jitinterface.cpp @@ -1561,13 +1561,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, fieldFlags |= CORINFO_FLG_FIELD_INITCLASS; } else - if (pField->IsContextStatic()) - { - fieldAccessor = CORINFO_FIELD_STATIC_ADDR_HELPER; - - pResult->helper = CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT; - } - else { // Regular or thread static CORINFO_FIELD_ACCESSOR intrinsicAccessor; @@ -1619,7 +1612,6 @@ void CEEInfo::getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken, // if ((flags & CORINFO_ACCESS_ADDRESS) && !pField->IsThreadStatic() && - !pField->IsContextStatic() && (fieldAccessor != CORINFO_FIELD_STATIC_TLS)) { fieldFlags |= CORINFO_FLG_FIELD_SAFESTATIC_BYREF_RETURN; diff --git a/src/vm/methodtable.h b/src/vm/methodtable.h index 2e9241242e..5d12796287 100644 --- a/src/vm/methodtable.h +++ b/src/vm/methodtable.h @@ -364,15 +364,6 @@ struct RemotingVtsInfo typedef DPTR(RemotingVtsInfo) PTR_RemotingVtsInfo; -struct ContextStaticsBucket -{ - // Offset which points to the CLS storage. Allocated lazily - -1 means no offset allocated yet. - DWORD m_dwContextStaticsOffset; - // Size of CLS fields - WORD m_wContextStaticsSize; -}; -typedef DPTR(ContextStaticsBucket) PTR_ContextStaticsBucket; - #ifdef FEATURE_COMINTEROP struct RCWPerTypeData; #endif // FEATURE_COMINTEROP @@ -4356,7 +4347,6 @@ private: BOOL needsCCWTemplate, BOOL needsRCWPerTypeData, BOOL needsRemotingVtsInfo, - BOOL needsContextStatic, BOOL needsTokenOverflow); inline DWORD GetOptionalMembersSize(); diff --git a/src/vm/methodtable.inl b/src/vm/methodtable.inl index f669f23a98..602163067d 100644 --- a/src/vm/methodtable.inl +++ b/src/vm/methodtable.inl @@ -1400,7 +1400,6 @@ inline DWORD MethodTable::GetOptionalMembersAllocationSize(DWORD dwMultipurposeS BOOL needsCCWTemplate, BOOL needsRCWPerTypeData, BOOL needsRemotingVtsInfo, - BOOL needsContextStatic, BOOL needsTokenOverflow) { LIMITED_METHOD_CONTRACT; @@ -1419,8 +1418,6 @@ inline DWORD MethodTable::GetOptionalMembersAllocationSize(DWORD dwMultipurposeS size += sizeof(UINT_PTR); if (needsRemotingVtsInfo) size += sizeof(UINT_PTR); - if (needsContextStatic) - size += sizeof(UINT_PTR); if (dwMultipurposeSlotsMask & enum_flag_HasInterfaceMap) size += sizeof(UINT_PTR); if (needsTokenOverflow) diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp index 15ce7d2af3..6450e3507f 100644 --- a/src/vm/methodtablebuilder.cpp +++ b/src/vm/methodtablebuilder.cpp @@ -774,8 +774,7 @@ void MethodTableBuilder::SetBMTData( bmtGCSeriesInfo *bmtGCSeries, bmtMethodImplInfo *bmtMethodImpl, const bmtGenericsInfo *bmtGenerics, - bmtEnumFieldInfo *bmtEnumFields, - bmtContextStaticInfo *bmtCSInfo) + bmtEnumFieldInfo *bmtEnumFields) { LIMITED_METHOD_CONTRACT; this->bmtAllocator = bmtAllocator; @@ -793,7 +792,6 @@ void MethodTableBuilder::SetBMTData( this->bmtMethodImpl = bmtMethodImpl; this->bmtGenerics = bmtGenerics; this->bmtEnumFields = bmtEnumFields; - this->bmtCSInfo = bmtCSInfo; } //******************************************************************************* @@ -1297,8 +1295,7 @@ MethodTableBuilder::BuildMethodTableThrowing( new (GetStackingAllocator()) bmtGCSeriesInfo(), new (GetStackingAllocator()) bmtMethodImplInfo(), bmtGenericsInfo, - new (GetStackingAllocator()) bmtEnumFieldInfo(pModule->GetMDImport()), - new (GetStackingAllocator()) bmtContextStaticInfo()); + new (GetStackingAllocator()) bmtEnumFieldInfo(pModule->GetMDImport())); //Initialize structs @@ -1751,7 +1748,7 @@ MethodTableBuilder::BuildMethodTableThrowing( // Go thru all fields and initialize their FieldDescs. InitializeFieldDescs(GetApproxFieldDescListRaw(), pLayoutRawFieldInfos, bmtInternal, bmtGenerics, bmtMetaData, bmtEnumFields, bmtError, - &pByValueClassCache, bmtMFDescs, bmtFP, bmtCSInfo, + &pByValueClassCache, bmtMFDescs, bmtFP, &totalDeclaredFieldSize); // Place regular static fields @@ -3687,7 +3684,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, MethodTable *** pByValueClassCache, bmtMethAndFieldDescs* bmtMFDescs, bmtFieldPlacement* bmtFP, - bmtContextStaticInfo* pbmtCSInfo, unsigned* totalDeclaredSize) { CONTRACTL @@ -3764,7 +3760,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, MethodTable * pByValueClass = NULL; BOOL fIsByValue = FALSE; BOOL fIsThreadStatic = FALSE; - static const BOOL fIsContextStatic = FALSE; BOOL fHasRVA = FALSE; MetaSig fsig(pMemberSignature, @@ -3817,18 +3812,14 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, // Do some sanity checks that we are not mixing context and thread // relative statics. - if (fHasRVA && (fIsThreadStatic || fIsContextStatic)) + if (fHasRVA && fIsThreadStatic) { IfFailThrow(COR_E_TYPELOAD); } - if ((fIsContextStatic || bmtFP->fHasFixedAddressValueTypes) && GetAssembly()->IsCollectible()) + if (bmtFP->fHasFixedAddressValueTypes && GetAssembly()->IsCollectible()) { - if (bmtFP->fHasFixedAddressValueTypes) - { - BuildMethodTableThrowException(IDS_CLASSLOAD_COLLECTIBLEFIXEDVTATTR); - } - BuildMethodTableThrowException(IDS_CLASSLOAD_COLLECTIBLESPECIALSTATICS); + BuildMethodTableThrowException(IDS_CLASSLOAD_COLLECTIBLEFIXEDVTATTR); } } @@ -4212,7 +4203,6 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, fIsStatic, fHasRVA, fIsThreadStatic, - fIsContextStatic, pszFieldName ); @@ -9801,8 +9791,7 @@ MethodTable * MethodTableBuilder::AllocateNewMT(Module *pLoaderModule, BOOL fHasGenericsStaticsInfo, BOOL fNeedsRCWPerTypeData, BOOL fNeedsRemotableMethodInfo, - BOOL fNeedsRemotingVtsInfo, - BOOL fHasContextStatics + BOOL fNeedsRemotingVtsInfo #ifdef FEATURE_COMINTEROP , BOOL fHasDynamicInterfaceMap #endif @@ -9853,7 +9842,6 @@ MethodTable * MethodTableBuilder::AllocateNewMT(Module *pLoaderModule, FALSE, // no CCW template needed for canonical instantiations fNeedsRCWPerTypeData, fNeedsRemotingVtsInfo, - fHasContextStatics, RidFromToken(GetCl()) >= METHODTABLE_TOKEN_OVERFLOW); // Interface map starts here @@ -10102,7 +10090,6 @@ MethodTableBuilder::SetupMethodTable2( : 0; - BOOL fHasContextStatics = FALSE; BOOL fNeedsRemotableMethodInfo=FALSE; BOOL fNeedsRemotingVtsInfo = FALSE; @@ -10147,7 +10134,6 @@ MethodTableBuilder::SetupMethodTable2( fNeedsRCWPerTypeData, fNeedsRemotableMethodInfo, fNeedsRemotingVtsInfo, - fHasContextStatics, #ifdef FEATURE_COMINTEROP fHasDynamicInterfaceMap, #endif diff --git a/src/vm/methodtablebuilder.h b/src/vm/methodtablebuilder.h index a2275af24f..cbcde31e03 100644 --- a/src/vm/methodtablebuilder.h +++ b/src/vm/methodtablebuilder.h @@ -79,15 +79,6 @@ public: #endif //_DEBUG }; // struct bmtGenericsInfo - - // information for Thread and Context Static. Filled by InitializedFieldDesc and used when - // setting up a MethodTable - struct bmtContextStaticInfo - { - - inline bmtContextStaticInfo() { LIMITED_METHOD_CONTRACT; memset((void *)this, NULL, sizeof(*this)); } - }; - MethodTableBuilder( MethodTable * pHalfBakedMT, EEClass * pHalfBakedClass, @@ -114,7 +105,6 @@ public: NULL, NULL, NULL, - NULL, NULL); } public: @@ -2212,7 +2202,6 @@ private: bmtMethodImplInfo *bmtMethodImpl; const bmtGenericsInfo *bmtGenerics; bmtEnumFieldInfo *bmtEnumFields; - bmtContextStaticInfo *bmtCSInfo; void SetBMTData( LoaderAllocator *bmtAllocator, @@ -2229,8 +2218,7 @@ private: bmtGCSeriesInfo *bmtGCSeries, bmtMethodImplInfo *bmtMethodImpl, const bmtGenericsInfo *bmtGenerics, - bmtEnumFieldInfo *bmtEnumFields, - bmtContextStaticInfo *bmtCSInfo); + bmtEnumFieldInfo *bmtEnumFields); // -------------------------------------------------------------------------------------------- // Returns the parent bmtRTType pointer. Can be null if no parent exists. @@ -2585,7 +2573,6 @@ private: MethodTable***, bmtMethAndFieldDescs*, bmtFieldPlacement*, - bmtContextStaticInfo*, unsigned * totalDeclaredSize); // -------------------------------------------------------------------------------------------- @@ -2955,8 +2942,7 @@ private: BOOL fHasGenericsStaticsInfo, BOOL fNeedsRCWPerTypeData, BOOL fNeedsRemotableMethodInfo, - BOOL fNeedsRemotingVtsInfo, - BOOL fHasContextStatics + BOOL fNeedsRemotingVtsInfo #ifdef FEATURE_COMINTEROP , BOOL bHasDynamicInterfaceMap #endif diff --git a/src/vm/object.h b/src/vm/object.h index e8ed2e77eb..5651a142dd 100644 --- a/src/vm/object.h +++ b/src/vm/object.h @@ -54,8 +54,6 @@ void ErectWriteBarrierForMT(MethodTable **dst, MethodTable *ref); * +-- code:AppDomainBaseObject - The base object for the class AppDomain * | * +-- code:AssemblyBaseObject - The base object for the class Assembly - * | - * +-- code:ContextBaseObject - base object for class Context * * * PLEASE NOTE THE FOLLOWING WHEN ADDING A NEW OBJECT TYPE: @@ -1576,80 +1574,6 @@ class MarshalByRefObjectBaseObject : public Object { }; - -// ContextBaseObject -// This class is the base class for Contexts -// -class ContextBaseObject : public Object -{ - friend class Context; - friend class MscorlibBinder; - - private: - // READ ME: - // Modifying the order or fields of this object may require other changes to the - // classlib class definition of this object. - - OBJECTREF m_ctxProps; // array of name-value pairs of properties - OBJECTREF m_dphCtx; // dynamic property holder - OBJECTREF m_localDataStore; // context local store - OBJECTREF m_serverContextChain; // server context sink chain - OBJECTREF m_clientContextChain; // client context sink chain - OBJECTREF m_exposedAppDomain; //appDomain ?? - PTRARRAYREF m_ctxStatics; // holder for context relative statics - - Context* m_internalContext; // Pointer to the VM context - - INT32 _ctxID; - INT32 _ctxFlags; - INT32 _numCtxProps; // current count of properties - - INT32 _ctxStaticsCurrentBucket; - INT32 _ctxStaticsFreeIndex; - - protected: - ContextBaseObject() { LIMITED_METHOD_CONTRACT; } - ~ContextBaseObject() { LIMITED_METHOD_CONTRACT; } - - public: - - void SetInternalContext(Context* pCtx) - { - LIMITED_METHOD_CONTRACT; - // either transitioning from NULL to non-NULL or vice versa. - // But not setting NULL to NULL or non-NULL to non-NULL. - _ASSERTE((m_internalContext == NULL) != (pCtx == NULL)); - m_internalContext = pCtx; - } - - Context* GetInternalContext() - { - LIMITED_METHOD_CONTRACT; - return m_internalContext; - } - - OBJECTREF GetExposedDomain() { return m_exposedAppDomain; } - OBJECTREF SetExposedDomain(OBJECTREF newDomain) - { - LIMITED_METHOD_CONTRACT; - OBJECTREF oldDomain = m_exposedAppDomain; - SetObjectReference( (OBJECTREF *)&m_exposedAppDomain, newDomain, GetAppDomain() ); - return oldDomain; - } - - PTRARRAYREF GetContextStaticsHolder() - { - LIMITED_METHOD_CONTRACT; - SUPPORTS_DAC; - // The code that needs this should have faulted it in by now! - _ASSERTE(m_ctxStatics != NULL); - - return m_ctxStatics; - } -}; - -typedef DPTR(ContextBaseObject) PTR_ContextBaseObject; - // AppDomainBaseObject // This class is the base class for application domains // @@ -2029,8 +1953,6 @@ typedef REF APPDOMAINREF; typedef REF MARSHALBYREFOBJECTBASEREF; -typedef REF CONTEXTBASEREF; - typedef REF ASSEMBLYREF; typedef REF ASSEMBLYNAMEREF; @@ -2084,7 +2006,6 @@ typedef PTR_ThreadBaseObject THREADBASEREF; typedef PTR_AppDomainBaseObject APPDOMAINREF; typedef PTR_AssemblyBaseObject ASSEMBLYREF; typedef PTR_AssemblyNameBaseObject ASSEMBLYNAMEREF; -typedef PTR_ContextBaseObject CONTEXTBASEREF; #ifndef DACCESS_COMPILE typedef MarshalByRefObjectBaseObject* MARSHALBYREFOBJECTBASEREF; diff --git a/src/vm/prestub.cpp b/src/vm/prestub.cpp index 1893cf6c23..cec6447c2e 100644 --- a/src/vm/prestub.cpp +++ b/src/vm/prestub.cpp @@ -2885,7 +2885,7 @@ PCODE DynamicHelperFixup(TransitionBlock * pTransitionBlock, TADDR * pCell, DWOR { if (pFD != NULL) { - if (pFD->IsRVA() || pFD->IsContextStatic()) + if (pFD->IsRVA()) { _ASSERTE(!"Fast getter for rare kinds of static fields"); } diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index 7127072cdf..425ceb87f7 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -3132,8 +3132,7 @@ HRESULT ProfToEEInterfaceImpl::GetRVAStaticAddress(ClassID classId, // if(!pFieldDesc->IsStatic() || !pFieldDesc->IsRVA() || - pFieldDesc->IsThreadStatic() || - pFieldDesc->IsContextStatic()) + pFieldDesc->IsThreadStatic()) { return E_INVALIDARG; } @@ -3271,8 +3270,7 @@ HRESULT ProfToEEInterfaceImpl::GetAppDomainStaticAddress(ClassID classId, // if(!pFieldDesc->IsStatic() || pFieldDesc->IsRVA() || - pFieldDesc->IsThreadStatic() || - pFieldDesc->IsContextStatic()) + pFieldDesc->IsThreadStatic()) { return E_INVALIDARG; } @@ -3494,8 +3492,7 @@ HRESULT ProfToEEInterfaceImpl::GetThreadStaticAddress2(ClassID classId, // if(!pFieldDesc->IsStatic() || !pFieldDesc->IsThreadStatic() || - pFieldDesc->IsRVA() || - pFieldDesc->IsContextStatic()) + pFieldDesc->IsRVA()) { return E_INVALIDARG; } @@ -3740,11 +3737,6 @@ HRESULT ProfToEEInterfaceImpl::GetStaticFieldInfo(ClassID classId, *pFieldInfo = COR_PRF_FIELD_NOT_A_STATIC; - if (pFieldDesc->IsContextStatic()) - { - *pFieldInfo = (COR_PRF_STATIC_TYPE)(*pFieldInfo | COR_PRF_FIELD_CONTEXT_STATIC); - } - if (pFieldDesc->IsRVA()) { *pFieldInfo = (COR_PRF_STATIC_TYPE)(*pFieldInfo | COR_PRF_FIELD_RVA_STATIC); -- cgit v1.2.3