Skip to content

Commit e532947

Browse files
committed
Remove VMPTR_Thread parameter from GetCurrentAppDomain
1 parent e59bbf7 commit e532947

File tree

5 files changed

+14
-39
lines changed

5 files changed

+14
-39
lines changed

src/coreclr/debug/daccess/dacdbiimpl.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4856,14 +4856,12 @@ VMPTR_OBJECTHANDLE DacDbiInterfaceImpl::GetCurrentCustomDebuggerNotification(VMP
48564856
return vmObjHandle;
48574857
}
48584858

4859-
// Return the current appdomain the specified thread is in.
4860-
VMPTR_AppDomain DacDbiInterfaceImpl::GetCurrentAppDomain(VMPTR_Thread vmThread)
4859+
// Return the current appdomain.
4860+
VMPTR_AppDomain DacDbiInterfaceImpl::GetCurrentAppDomain()
48614861
{
48624862
DD_ENTER_MAY_THROW;
48634863

4864-
Thread * pThread = vmThread.GetDacPtr();
48654864
AppDomain * pAppDomain = AppDomain::GetCurrentDomain();
4866-
48674865
VMPTR_AppDomain vmAppDomain = VMPTR_AppDomain::NullPtr();
48684866
vmAppDomain.SetDacTargetPtr(PTR_HOST_TO_TADDR(pAppDomain));
48694867
return vmAppDomain;

src/coreclr/debug/daccess/dacdbiimpl.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -822,9 +822,8 @@ class DacDbiInterfaceImpl :
822822
// (or a dump was generated while in this callback)
823823
VMPTR_OBJECTHANDLE GetCurrentCustomDebuggerNotification(VMPTR_Thread vmThread);
824824

825-
826-
// Return the current appdomain the specified thread is in.
827-
VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread);
825+
// Return the current appdomain
826+
VMPTR_AppDomain GetCurrentAppDomain();
828827

829828
// Given an assembly ref token and metadata scope (via the DomainAssembly), resolve the assembly.
830829
VMPTR_DomainAssembly ResolveAssembly(VMPTR_DomainAssembly vmScope, mdToken tkAssemblyRef);

src/coreclr/debug/di/process.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8691,18 +8691,18 @@ CordbAppDomain * CordbProcess::LookupOrCreateAppDomain(VMPTR_AppDomain vmAppDoma
86918691
CordbAppDomain * CordbProcess::GetAppDomain()
86928692
{
86938693
// Return the one and only app domain
8694-
const ULONG appDomainId = 1; // DefaultADID in appdomain.hpp
86958694
HASHFIND find;
86968695
CordbAppDomain* appDomain = m_appDomains.FindFirst(&find);
86978696
if (appDomain != NULL)
86988697
{
8698+
const ULONG appDomainId = 1; // DefaultADID in appdomain.hpp
86998699
ULONG32 id;
87008700
HRESULT hr = appDomain->GetID(&id);
87018701
TargetConsistencyCheck(SUCCEEDED(hr) && id == appDomainId);
87028702
return appDomain;
87038703
}
87048704

8705-
VMPTR_AppDomain vmAppDomain = GetDAC()->GetAppDomainFromId(appDomainId);
8705+
VMPTR_AppDomain vmAppDomain = GetDAC()->GetCurrentAppDomain();
87068706
appDomain = LookupOrCreateAppDomain(vmAppDomain);
87078707
return appDomain;
87088708
}

src/coreclr/debug/di/rsthread.cpp

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ CordbThread::CordbThread(CordbProcess * pProcess, VMPTR_Thread vmThread) :
115115
#endif
116116

117117
// Set AppDomain
118-
VMPTR_AppDomain vmAppDomain = pProcess->GetDAC()->GetCurrentAppDomain(vmThread);
119-
m_pAppDomain = pProcess->LookupOrCreateAppDomain(vmAppDomain);
118+
m_pAppDomain = pProcess->GetAppDomain();
120119
_ASSERTE(m_pAppDomain != NULL);
121120
}
122121

@@ -828,7 +827,7 @@ HRESULT CordbThread::GetCurrentException(ICorDebugValue ** ppExceptionObject)
828827
#if defined(_DEBUG)
829828
// Since we know an exception is in progress on this thread, our assumption about the
830829
// thread's current AppDomain should be correct
831-
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain(m_vmThreadToken);
830+
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain();
832831
_ASSERTE(GetAppDomain()->GetADToken() == vmAppDomain);
833832
#endif // _DEBUG
834833

@@ -1843,12 +1842,8 @@ HRESULT CordbThread::GetCurrentAppDomain(CordbAppDomain ** ppAppDomain)
18431842

18441843
if (SUCCEEDED(hr))
18451844
{
1846-
IDacDbiInterface * pDAC = GetProcess()->GetDAC();
1847-
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain(m_vmThreadToken);
1848-
1849-
CordbAppDomain * pAppDomain = GetProcess()->LookupOrCreateAppDomain(vmAppDomain);
1845+
CordbAppDomain * pAppDomain = GetProcess()->GetAppDomain();
18501846
_ASSERTE(pAppDomain != NULL); // we should be aware of all AppDomains
1851-
18521847
*ppAppDomain = pAppDomain;
18531848
}
18541849
}
@@ -1896,23 +1891,9 @@ HRESULT CordbThread::GetObject(ICorDebugValue ** ppThreadObject)
18961891
ThrowHR(E_FAIL);
18971892
}
18981893

1899-
// We create the object relative to the current AppDomain of the thread
1900-
// Thread objects aren't really agile (eg. their m_Context field is domain-bound and
1901-
// fixed up manually during transitions). This means that a thread object can only
1902-
// be used in the domain the thread was in when the object was created.
1903-
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain(m_vmThreadToken);
1904-
1905-
CordbAppDomain * pThreadCurrentDomain = NULL;
1906-
pThreadCurrentDomain = GetProcess()->m_appDomains.GetBaseOrThrow(VmPtrToCookie(vmAppDomain));
1894+
CordbAppDomain * pThreadCurrentDomain = pThreadCurrentDomain = GetProcess()->GetAppDomain();
19071895
_ASSERTE(pThreadCurrentDomain != NULL); // we should be aware of all AppDomains
19081896

1909-
if (pThreadCurrentDomain == NULL)
1910-
{
1911-
// fall back to some domain to avoid crashes in retail -
1912-
// safe enough for getting the name of the thread etc.
1913-
pThreadCurrentDomain = GetProcess()->GetAppDomain();
1914-
}
1915-
19161897
lockHolder.Release();
19171898

19181899
ICorDebugReferenceValue * pRefValue = NULL;
@@ -2442,7 +2423,7 @@ HRESULT CordbThread::GetCurrentCustomDebuggerNotification(ICorDebugValue ** ppNo
24422423
#if defined(_DEBUG)
24432424
// Since we know a notification has occurred on this thread, our assumption about the
24442425
// thread's current AppDomain should be correct
2445-
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain(m_vmThreadToken);
2426+
VMPTR_AppDomain vmAppDomain = pDAC->GetCurrentAppDomain();
24462427

24472428
_ASSERTE(GetAppDomain()->GetADToken() == vmAppDomain);
24482429
#endif // _DEBUG

src/coreclr/debug/inc/dacdbiinterface.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,20 +1212,17 @@ class IDacDbiInterface
12121212

12131213

12141214
//
1215-
// Return the current appdomain the specified thread is in.
1216-
//
1217-
// Arguments:
1218-
// vmThread - the specified thread
1215+
// Return the current appdomain.
12191216
//
12201217
// Return Value:
1221-
// the current appdomain of the specified thread
1218+
// the current appdomain
12221219
//
12231220
// Notes:
12241221
// This function throws if the current appdomain is NULL for whatever reason.
12251222
//
12261223

12271224
virtual
1228-
VMPTR_AppDomain GetCurrentAppDomain(VMPTR_Thread vmThread) = 0;
1225+
VMPTR_AppDomain GetCurrentAppDomain() = 0;
12291226

12301227

12311228
//

0 commit comments

Comments
 (0)