Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TESTONLY] Add all changes for statics as one commit #101691

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ internal unsafe struct MethodTableAuxiliaryData
[FieldOffset(0)]
private uint Flags;

private const uint enum_flag_CanCompareBitsOrUseFastGetHashCode = 0x0001; // Is any field type or sub field type overrode Equals or GetHashCode
private const uint enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode = 0x0002; // Whether we have checked the overridden Equals or GetHashCode
private const uint enum_flag_CanCompareBitsOrUseFastGetHashCode = 0x0004; // Is any field type or sub field type overrode Equals or GetHashCode

public bool HasCheckedCanCompareBitsOrUseFastGetHashCode => (Flags & enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode) != 0;

Expand Down
70 changes: 8 additions & 62 deletions src/coreclr/debug/daccess/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1675,8 +1675,8 @@ ClrDataAccess::GetModuleData(CLRDATA_ADDRESS addr, struct DacpModuleData *Module
ModuleData->bIsReflection = pModule->IsReflection();
ModuleData->bIsPEFile = pModule->IsPEFile();
ModuleData->Assembly = HOST_CDADDR(pModule->GetAssembly());
ModuleData->dwModuleID = pModule->GetModuleID();
ModuleData->dwModuleIndex = pModule->GetModuleIndex().m_dwIndex;
ModuleData->dwModuleID = 0; // CoreCLR no longer has this concept
ModuleData->dwModuleIndex = 0; // CoreCLR no longer has this concept
ModuleData->dwTransientFlags = pModule->m_dwTransientFlags;
ModuleData->LoaderAllocator = HOST_CDADDR(pModule->m_loaderAllocator);
ModuleData->ThunkHeap = HOST_CDADDR(pModule->m_pThunkHeap);
Expand Down Expand Up @@ -3206,47 +3206,16 @@ ClrDataAccess::GetNestedExceptionData(CLRDATA_ADDRESS exception, CLRDATA_ADDRESS
HRESULT
ClrDataAccess::GetDomainLocalModuleData(CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *pLocalModuleData)
{
if (addr == 0 || pLocalModuleData == NULL)
return E_INVALIDARG;

SOSDacEnter();

DomainLocalModule* pLocalModule = PTR_DomainLocalModule(TO_TADDR(addr));

pLocalModuleData->pGCStaticDataStart = TO_CDADDR(PTR_TO_TADDR(pLocalModule->GetPrecomputedGCStaticsBasePointer()));
pLocalModuleData->pNonGCStaticDataStart = TO_CDADDR(pLocalModule->GetPrecomputedNonGCStaticsBasePointer());
pLocalModuleData->pDynamicClassTable = PTR_CDADDR(pLocalModule->m_pDynamicClassTable.Load());
pLocalModuleData->pClassData = (TADDR) (PTR_HOST_MEMBER_TADDR(DomainLocalModule, pLocalModule, m_pDataBlob));

SOSDacLeave();
return hr;
// CoreCLR does not use domain local modules anymore
return E_NOTIMPL;
}


HRESULT
ClrDataAccess::GetDomainLocalModuleDataFromModule(CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *pLocalModuleData)
{
if (addr == 0 || pLocalModuleData == NULL)
return E_INVALIDARG;

SOSDacEnter();

Module* pModule = PTR_Module(TO_TADDR(addr));
DomainLocalModule* pLocalModule = PTR_DomainLocalModule(pModule->GetDomainLocalModule());
if (!pLocalModule)
{
hr = E_INVALIDARG;
}
else
{
pLocalModuleData->pGCStaticDataStart = TO_CDADDR(PTR_TO_TADDR(pLocalModule->GetPrecomputedGCStaticsBasePointer()));
pLocalModuleData->pNonGCStaticDataStart = TO_CDADDR(pLocalModule->GetPrecomputedNonGCStaticsBasePointer());
pLocalModuleData->pDynamicClassTable = PTR_CDADDR(pLocalModule->m_pDynamicClassTable.Load());
pLocalModuleData->pClassData = (TADDR) (PTR_HOST_MEMBER_TADDR(DomainLocalModule, pLocalModule, m_pDataBlob));
}

SOSDacLeave();
return hr;
// CoreCLR does not use domain local modules anymore
return E_NOTIMPL;
}

HRESULT
Expand All @@ -3259,31 +3228,8 @@ ClrDataAccess::GetDomainLocalModuleDataFromAppDomain(CLRDATA_ADDRESS appDomainAd
HRESULT
ClrDataAccess::GetThreadLocalModuleData(CLRDATA_ADDRESS thread, unsigned int index, struct DacpThreadLocalModuleData *pLocalModuleData)
{
if (pLocalModuleData == NULL)
return E_INVALIDARG;

SOSDacEnter();

pLocalModuleData->threadAddr = thread;
pLocalModuleData->ModuleIndex = index;

PTR_Thread pThread = PTR_Thread(TO_TADDR(thread));
PTR_ThreadLocalBlock pLocalBlock = ThreadStatics::GetCurrentTLB(pThread);
PTR_ThreadLocalModule pLocalModule = pLocalBlock->GetTLMIfExists(ModuleIndex(index));
if (!pLocalModule)
{
hr = E_INVALIDARG;
}
else
{
pLocalModuleData->pGCStaticDataStart = TO_CDADDR(PTR_TO_TADDR(pLocalModule->GetPrecomputedGCStaticsBasePointer()));
pLocalModuleData->pNonGCStaticDataStart = TO_CDADDR(pLocalModule->GetPrecomputedNonGCStaticsBasePointer());
pLocalModuleData->pDynamicClassTable = PTR_CDADDR(pLocalModule->m_pDynamicClassTable);
pLocalModuleData->pClassData = (TADDR) (PTR_HOST_MEMBER_TADDR(ThreadLocalModule, pLocalModule, m_pDataBlob));
}

SOSDacLeave();
return hr;
// CoreCLR does not use thread local modules anymore
return E_NOTIMPL;
}


Expand Down
18 changes: 9 additions & 9 deletions src/coreclr/inc/CrstTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ End
Crst DelegateToFPtrHash
End

Crst DomainLocalBlock
Crst GenericDictionaryExpansion
AcquiredBefore PinnedHeapHandleTable IbcProfile LoaderHeap SystemDomainDelayedUnloadList UniqueStack
End

Expand Down Expand Up @@ -265,7 +265,7 @@ Crst InstMethodHashTable
End

Crst Interop
AcquiredBefore PinnedHeapHandleTable AvailableParamTypes ClassInit DeadlockDetection DomainLocalBlock
AcquiredBefore PinnedHeapHandleTable AvailableParamTypes ClassInit DeadlockDetection GenericDictionaryExpansion
HandleTable InstMethodHashTable InteropData JitGenericHandleCache LoaderHeap SigConvert
StubDispatchCache StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock
PendingTypeLoadEntry
Expand Down Expand Up @@ -315,7 +315,7 @@ End

Crst LoaderAllocator
AcquiredBefore PinnedHeapHandleTable HandleTable UniqueStack ThreadStore
AcquiredAfter DomainLocalBlock
AcquiredAfter GenericDictionaryExpansion
End

Crst LoaderAllocatorReferences
Expand Down Expand Up @@ -364,7 +364,7 @@ End
Crst PendingTypeLoadEntry
AcquiredBefore AppDomainCache PinnedHeapHandleTable AssemblyLoader AvailableClass AvailableParamTypes
BaseDomain ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex
DomainLocalBlock Exception ExecuteManRangeLock FuncPtrStubs
GenericDictionaryExpansion Exception ExecuteManRangeLock FuncPtrStubs
FusionAppCtx GlobalStrLiteralMap HandleTable IbcProfile
IJWFixupData IJWHash ISymUnmanagedReader Jit JumpStubCache LoaderHeap
Module ModuleLookupTable PEImage
Expand Down Expand Up @@ -476,6 +476,10 @@ End
Crst SystemDomainDelayedUnloadList
End

Crst ThreadLocalStorageLock
AcquiredBefore ModuleLookupTable
End

Crst ThreadIdDispenser
End

Expand Down Expand Up @@ -541,7 +545,7 @@ End

Crst EventPipe
AcquiredAfter PendingTypeLoadEntry
AcquiredBefore ThreadIdDispenser ThreadStore DomainLocalBlock InstMethodHashTable
AcquiredBefore ThreadIdDispenser ThreadStore GenericDictionaryExpansion InstMethodHashTable
End

Crst NotifyGdb
Expand Down Expand Up @@ -574,10 +578,6 @@ Crst PgoData
AcquiredBefore LoaderHeap
End

Crst StaticBoxInit
AcquiredBefore LoaderHeap FrozenObjectHeap AssemblyLoader
End

Crst PerfMap
AcquiredAfter CodeVersioning AssemblyList
End
2 changes: 0 additions & 2 deletions src/coreclr/inc/corcompile.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,6 @@ enum CORCOMPILE_FIXUP_BLOB_KIND
ENCODE_VERIFY_IL_BODY, /* Verify an IL body is defined the same at compile time and runtime. A failed match will cause a hard runtime failure. */

ENCODE_MODULE_HANDLE = 0x50, /* Module token */
ENCODE_MODULE_ID_FOR_GENERIC_STATICS, /* For accessing static fields */
ENCODE_CLASS_ID_FOR_STATICS, /* For accessing static fields */
ENCODE_SYNC_LOCK, /* For synchronizing access to a type */
ENCODE_PROFILING_HANDLE, /* For the method's profiling counter */
ENCODE_VARARGS_METHODDEF, /* For calling a varargs method */
Expand Down
66 changes: 31 additions & 35 deletions src/coreclr/inc/corinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,28 +528,30 @@ enum CorInfoHelpFunc
// ICorClassInfo::getSharedStaticsOrCCtorHelper to determine which helper to use

// Helpers for regular statics
CORINFO_HELP_GETGENERICS_GCSTATIC_BASE,
CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS,
CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS,
// Helper to class initialize shared generic with dynamicclass, but not get static field address
CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS,
CORINFO_HELP_GET_GCSTATIC_BASE,
CORINFO_HELP_GET_NONGCSTATIC_BASE,
CORINFO_HELP_GETDYNAMIC_GCSTATIC_BASE,
CORINFO_HELP_GETDYNAMIC_NONGCSTATIC_BASE,
CORINFO_HELP_GETPINNED_GCSTATIC_BASE,
CORINFO_HELP_GETPINNED_NONGCSTATIC_BASE,
CORINFO_HELP_GET_GCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GET_NONGCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETDYNAMIC_GCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETDYNAMIC_NONGCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETPINNED_GCSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETPINNED_NONGCSTATIC_BASE_NOCTOR,

// Helpers for thread statics
CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE,
CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS,
CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,
CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,
CORINFO_HELP_GET_GCTHREADSTATIC_BASE,
CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE,
CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE,
CORINFO_HELP_GET_GCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GET_NONGCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR,
CORINFO_HELP_GETDYNAMIC_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,
CORINFO_HELP_GETDYNAMIC_NONGCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED,

/* Debugger */

Expand Down Expand Up @@ -1698,7 +1700,6 @@ struct CORINFO_THREAD_STATIC_BLOCKS_INFO
uint32_t offsetOfThreadLocalStoragePointer; // windows specific
uint32_t offsetOfMaxThreadStaticBlocks;
uint32_t offsetOfThreadStaticBlocks;
uint32_t offsetOfGCDataPointer;
};

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -2399,18 +2400,20 @@ class ICorStaticInfo
virtual void* LongLifetimeMalloc(size_t sz) = 0;
virtual void LongLifetimeFree(void* obj) = 0;

virtual size_t getClassModuleIdForStatics (
CORINFO_CLASS_HANDLE cls,
CORINFO_MODULE_HANDLE * pModule,
void ** ppIndirection
) = 0;

virtual bool getIsClassInitedFlagAddress(
CORINFO_CLASS_HANDLE cls,
CORINFO_CONST_LOOKUP* addr,
int* offset
) = 0;

virtual size_t getClassStaticDynamicInfo (
CORINFO_CLASS_HANDLE cls
) = 0;

virtual size_t getClassThreadStaticDynamicInfo (
CORINFO_CLASS_HANDLE cls
) = 0;

virtual bool getStaticBaseAddress(
CORINFO_CLASS_HANDLE cls,
bool isGc,
Expand Down Expand Up @@ -2820,8 +2823,7 @@ class ICorStaticInfo

// Returns the thread static block information like offsets, etc. from current TLS.
virtual void getThreadLocalStaticBlocksInfo (
CORINFO_THREAD_STATIC_BLOCKS_INFO* pInfo,
bool isGCType
CORINFO_THREAD_STATIC_BLOCKS_INFO* pInfo
) = 0;

virtual void getThreadLocalStaticInfo_NativeAOT(
Expand Down Expand Up @@ -3241,12 +3243,6 @@ class ICorDynamicInfo : public ICorStaticInfo
CORINFO_CALL_INFO *pResult
) = 0;

// Returns the class's domain ID for accessing shared statics
virtual unsigned getClassDomainID (
CORINFO_CLASS_HANDLE cls,
void **ppIndirection = NULL
) = 0;

//------------------------------------------------------------------------------
// getStaticFieldContent: returns true and the actual field's value if the given
// field represents a statically initialized readonly field of any type.
Expand Down
Loading
Loading