-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Make normal statics simpler #99183
Make normal statics simpler #99183
Changes from 22 commits
b57c72b
e47278b
34420e0
3cb0324
37e2555
78720e1
c375996
5ec61b2
e88cda8
2eb6eb8
aa741bc
f805eda
d463f59
6aed90a
1bb643a
02ee7a1
e3e8cd6
92153b0
a8f9b73
d37f612
0c0545e
6a9a062
abe8a97
3380e00
785f32f
504d93e
8afc63e
b8ef938
fce7f9f
8bd309c
6cb70fa
7db100e
1595cf0
961744d
69de672
57c3025
94b58ed
170f74c
87ae678
a1b5e17
4543b03
53a68a0
378ecc1
f38ae83
66cd564
0e7c1d4
446a60e
b2850ea
d526181
e2aa42f
24801db
662579b
43e4e52
37ee3e9
07f7d14
cd157be
e8273e6
4b27a95
f111ecd
f6aaa69
61823a4
99c678a
5914558
4563623
11c671f
bc16c62
ec88375
0ef9bb1
53cd1f6
160acba
cacb466
1053165
43abbf3
42fffaa
8d9ddba
35c935e
d48ef55
638ea50
bcff9aa
fc67ecd
4e2e0c2
4e78250
02b5899
100c2ad
3888af5
270e991
2db5ffd
0be084d
8d7243b
b08d8eb
a94b00c
3b94fa0
e702b91
ecd26bc
42f3eb9
a6225c1
548842e
e6f47d1
973a0f8
71a4ae9
5afc45a
8ca9b7c
07f1739
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1640,8 +1640,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); | ||
|
@@ -3171,47 +3171,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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to come with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The check/warning message in SOS is only done for commands that assume runtime data structure layout like dumplog, threads -special, printexception. These 2 APIs are called in dumpobj which doesn't do the check and will fail with no warning. It looks like SOS should do the check/warning on every command. I didn't consider these type of API breaking changes just layout changes when I added the checks. I'll add a SOS tracking issue to address this. In the end, yes, SOS_BREAKING_CHANGE_VERSION should be bumped. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. I had interpreted the failures in !dumpobj as pretty reasonable and not breaking. The way it failed is fairly graceful, as instead of crashing, SOS would simply report There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It impacts clrmd too.
I think it is hard for a random person out there to connect the dots between SOS failing to dump the statics and needing a newer SOS version to fix that. |
||
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 | ||
|
@@ -3224,31 +3193,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; | ||
} | ||
|
||
|
||
|
@@ -5401,3 +5347,113 @@ HRESULT ClrDataAccess::LockedFlush() | |
SOSDacLeave(); | ||
return hr; | ||
} | ||
|
||
HRESULT STDMETHODCALLTYPE ClrDataAccess::GetStaticBaseAddress(CLRDATA_ADDRESS methodTable, BOOL isGCStaticBase, CLRDATA_ADDRESS *address) | ||
{ | ||
if (!address) | ||
return E_POINTER; | ||
|
||
if (!methodTable) | ||
return E_INVALIDARG; | ||
|
||
SOSDacEnter(); | ||
|
||
PTR_MethodTable mTable = PTR_MethodTable(TO_TADDR(methodTable)); | ||
|
||
BOOL bIsFree = FALSE; | ||
if (!DacValidateMethodTable(mTable, bIsFree)) | ||
{ | ||
hr = E_INVALIDARG; | ||
} | ||
else | ||
{ | ||
if (!mTable->IsDynamicStatics()) | ||
{ | ||
*address = 0; | ||
} | ||
if (isGCStaticBase) | ||
{ | ||
*address = PTR_CDADDR(mTable->GetGCStaticsBasePointer()); | ||
} | ||
else | ||
{ | ||
*address = PTR_CDADDR(mTable->GetNonGCStaticsBasePointer()); | ||
} | ||
} | ||
|
||
SOSDacLeave(); | ||
return hr; | ||
} | ||
|
||
|
||
HRESULT STDMETHODCALLTYPE ClrDataAccess::GetThreadStaticBaseAddress(CLRDATA_ADDRESS methodTable, CLRDATA_ADDRESS threadPtr, BOOL isGCStaticBase, CLRDATA_ADDRESS *address) | ||
{ | ||
if (!address) | ||
return E_POINTER; | ||
|
||
if (!methodTable) | ||
return E_INVALIDARG; | ||
|
||
if (!threadPtr) | ||
return E_INVALIDARG; | ||
|
||
SOSDacEnter(); | ||
|
||
PTR_MethodTable mTable = PTR_MethodTable(TO_TADDR(methodTable)); | ||
PTR_Thread thread = PTR_Thread(TO_TADDR(threadPtr)); | ||
|
||
|
||
BOOL bIsFree = FALSE; | ||
if (!DacValidateMethodTable(mTable, bIsFree)) | ||
{ | ||
hr = E_INVALIDARG; | ||
} | ||
else | ||
{ | ||
if (mTable->GetClass()->GetNumThreadStaticFields() == 0) | ||
{ | ||
*address = 0; | ||
} | ||
if (isGCStaticBase) | ||
{ | ||
*address = PTR_CDADDR(mTable->GetGCThreadStaticsBasePointer(thread)); | ||
} | ||
else | ||
{ | ||
*address = PTR_CDADDR(mTable->GetNonGCThreadStaticsBasePointer(thread)); | ||
} | ||
} | ||
|
||
SOSDacLeave(); | ||
return hr; | ||
} | ||
|
||
HRESULT STDMETHODCALLTYPE ClrDataAccess::GetMethodTableInitializationFlags(CLRDATA_ADDRESS methodTable, MethodTableInitializationFlags *initializationStatus) | ||
{ | ||
if (!methodTable) | ||
return E_INVALIDARG; | ||
|
||
if (!initializationStatus) | ||
return E_POINTER; | ||
|
||
SOSDacEnter(); | ||
|
||
*initializationStatus = (MethodTableInitializationFlags)0; | ||
PTR_MethodTable mTable = PTR_MethodTable(TO_TADDR(methodTable)); | ||
BOOL bIsFree = FALSE; | ||
if (!DacValidateMethodTable(mTable, bIsFree)) | ||
{ | ||
hr = E_INVALIDARG; | ||
} | ||
else | ||
{ | ||
*initializationStatus = mTable->IsClassInited() ? MethodTableInitialized : (MethodTableInitializationFlags)0; | ||
if (mTable->GetAuxiliaryData()->IsInitError()) | ||
{ | ||
*initializationStatus = (MethodTableInitializationFlags)(*initializationStatus | MethodTableInitializationFailed); | ||
} | ||
} | ||
|
||
SOSDacLeave(); | ||
return hr; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also move it after enum_flag_HasCheckedCanCompareBitsOrUseFastGetHashCode