Remove context statics stuff (#20256)
authorJan Vorlicek <janvorli@microsoft.com>
Fri, 5 Oct 2018 01:08:51 +0000 (03:08 +0200)
committerGitHub <noreply@github.com>
Fri, 5 Oct 2018 01:08:51 +0000 (03:08 +0200)
* 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

24 files changed:
src/ToolBox/SOS/Strike/strike.cpp
src/ToolBox/SOS/Strike/util.cpp
src/debug/daccess/dacdbiimpl.cpp
src/debug/di/rsclass.cpp
src/debug/inc/dacdbistructures.h
src/debug/inc/dacdbistructures.inl
src/dlls/mscorrc/mscorrc.rc
src/dlls/mscorrc/resource.h
src/vm/appdomain.cpp
src/vm/appdomain.hpp
src/vm/array.cpp
src/vm/class.cpp
src/vm/classnames.h
src/vm/field.cpp
src/vm/field.h
src/vm/generics.cpp
src/vm/jitinterface.cpp
src/vm/methodtable.h
src/vm/methodtable.inl
src/vm/methodtablebuilder.cpp
src/vm/methodtablebuilder.h
src/vm/object.h
src/vm/prestub.cpp
src/vm/proftoeeinterfaceimpl.cpp

index 70e6031..65e2aaf 100644 (file)
@@ -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);
index db461ba..9e124c4 100644 (file)
@@ -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);
-                }
             }
     
         }
index 57f9f6b..2ce8c72 100644 (file)
@@ -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);
 
index ff82466..99fac5e 100644 (file)
@@ -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;
index a8ff067..fc894f3 100644 (file)
@@ -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
 
index 4874913..58166c1 100644 (file)
@@ -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;
index 713d7e0..050b260 100644 (file)
@@ -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."
 
index 0a42dad..189948a 100644 (file)
 #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
index 8f8efcf..61f709a 100644 (file)
@@ -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
index 5ffc1b2..6ba9ff4 100644 (file)
@@ -1431,17 +1431,10 @@ 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.
     void ClearFusionContext();
index 5103e9e..e41573c 100644 (file)
@@ -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
index fe7fe7e..08d0015 100644 (file)
@@ -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);
index fec3052..1c1c545 100644 (file)
@@ -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"
 
index 78cb7f5..4c4d89a 100644 (file)
@@ -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);
index 4962fce..a09b405 100644 (file)
@@ -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() 
index a92177d..26cd8a5 100644 (file)
@@ -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...
index 28e17e9..293bab9 100644 (file)
@@ -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;
index 2e92412..5d12796 100644 (file)
@@ -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();
 
index f669f23..6021630 100644 (file)
@@ -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)
index 15ce7d2..6450e35 100644 (file)
@@ -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
index a2275af..cbcde31 100644 (file)
@@ -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
index e8ed2e7..5651a14 100644 (file)
@@ -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<AppDomainBaseObject> APPDOMAINREF;
 
 typedef REF<MarshalByRefObjectBaseObject> MARSHALBYREFOBJECTBASEREF;
 
-typedef REF<ContextBaseObject> CONTEXTBASEREF;
-
 typedef REF<AssemblyBaseObject> ASSEMBLYREF;
 
 typedef REF<AssemblyNameBaseObject> 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;
index 1893cf6..cec6447 100644 (file)
@@ -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");
                             }
index 7127072..425ceb8 100644 (file)
@@ -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);