Skip to content
Merged
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
12 changes: 0 additions & 12 deletions src/coreclr/src/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,18 +587,6 @@ VMPTR_OBJECTHANDLE DacDbiInterfaceImpl::GetAppDomainObject(VMPTR_AppDomain vmApp

}

// Determine if the specified AppDomain is the default domain
BOOL DacDbiInterfaceImpl::IsDefaultDomain(VMPTR_AppDomain vmAppDomain)
{
DD_ENTER_MAY_THROW;

AppDomain * pAppDomain = vmAppDomain.GetDacPtr();
BOOL fDefaultDomain = pAppDomain->IsDefaultDomain();

return fDefaultDomain;
}


// Get the full AD friendly name for the given EE AppDomain.
void DacDbiInterfaceImpl::GetAppDomainFullName(
VMPTR_AppDomain vmAppDomain,
Expand Down
3 changes: 0 additions & 3 deletions src/coreclr/src/debug/daccess/dacdbiimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ class DacDbiInterfaceImpl :
// Get the managed AppDomain object for an AppDomain.
VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain);

// Determine if the specified AppDomain is the default domain
BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain);

// Get the full AD friendly name for the appdomain.
void GetAppDomainFullName(
VMPTR_AppDomain vmAppDomain,
Expand Down
15 changes: 3 additions & 12 deletions src/coreclr/src/debug/di/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8763,18 +8763,9 @@ CordbAppDomain * CordbProcess::CacheAppDomain(VMPTR_AppDomain vmAppDomain)
// The cache will take ownership.
m_appDomains.AddBaseOrThrow(pAppDomain);

// see if this is the default AppDomain
IDacDbiInterface * pDac = m_pProcess->GetDAC();
BOOL fIsDefaultDomain = FALSE;

fIsDefaultDomain = pDac->IsDefaultDomain(vmAppDomain); // throws

if (fIsDefaultDomain)
{
// If this assert fires, then it likely means the target is corrupted.
TargetConsistencyCheck(m_pDefaultAppDomain == NULL);
m_pDefaultAppDomain = pAppDomain;
}
// If this assert fires, then it likely means the target is corrupted.
TargetConsistencyCheck(m_pDefaultAppDomain == NULL);
m_pDefaultAppDomain = pAppDomain;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_pDefaultAppDomain could be renamed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this name is ok. Many other names (including APIs) and comments talk about default appdomain too.


CordbAppDomain * pReturn = pAppDomain;
pAppDomain.ClearAndMarkDontNeuter();
Expand Down
75 changes: 3 additions & 72 deletions src/coreclr/src/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9434,73 +9434,6 @@ void Debugger::SendCreateAppDomainEvent(AppDomain * pRuntimeAppDomain)
}




//
// SendExitAppDomainEvent is called when an app domain is destroyed.
//
void Debugger::SendExitAppDomainEvent(AppDomain* pRuntimeAppDomain)
{
CONTRACTL
{
MAY_DO_HELPER_THREAD_DUTY_THROWS_CONTRACT;
MAY_DO_HELPER_THREAD_DUTY_GC_TRIGGERS_CONTRACT;
}
CONTRACTL_END;

if (CORDBUnrecoverableError(this))
return;

LOG((LF_CORDB, LL_INFO100, "D::EAD: Exit AppDomain 0x%08x.\n",
pRuntimeAppDomain));

STRESS_LOG2(LF_CORDB, LL_INFO10000, "D::EAD: AppDomain exit:%#08x, %#08x\n",
pRuntimeAppDomain, CORDebuggerAttached());

Thread *thread = g_pEEInterface->GetThread();
// Prevent other Runtime threads from handling events.
SENDIPCEVENT_BEGIN(this, thread);

if (CORDebuggerAttached())
{
if (pRuntimeAppDomain->IsDefaultDomain() )
{
// The Debugger expects to never get an unload event for the default Domain.
// Currently we should never get here because g_fProcessDetach will be true by
// the time this method is called. However, we'd like to know if this ever changes
_ASSERTE(!"Trying to deliver notification of unload for default domain" );
Comment thread
jkotas marked this conversation as resolved.
return;
}

// Send the exit appdomain event to the Right Side.
DebuggerIPCEvent* ipce = m_pRCThread->GetIPCEventSendBuffer();
InitIPCEvent(ipce,
DB_IPCE_EXIT_APP_DOMAIN,
thread,
pRuntimeAppDomain);
m_pRCThread->SendIPCEvent();

// Delete any left over modules for this appdomain.
// Note that we're doing this under the lock.
if (m_pModules != NULL)
{
DebuggerDataLockHolder ch(this);
m_pModules->RemoveModules(pRuntimeAppDomain);
}

// Stop all Runtime threads
TrapAllRuntimeThreads();
}
else
{
LOG((LF_CORDB,LL_INFO1000, "D::EAD: Skipping SendIPCEvent because RS detached."));
}

SENDIPCEVENT_END;
}



//
// LoadAssembly is called when a new Assembly gets loaded.
//
Expand Down Expand Up @@ -14915,11 +14848,9 @@ HRESULT Debugger::RemoveAppDomainFromIPC (AppDomain *pAppDomain)
// UnLock the list
m_pAppDomainCB->Unlock();

// send event to debugger if one is attached
if (CORDebuggerAttached())
{
SendExitAppDomainEvent(pAppDomain);
}
//
// The Debugger expects to never get an unload event for the default AppDomain.
//

return hr;
}
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/debug/ee/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -2539,7 +2539,6 @@ class Debugger : public DebugInterface
HRESULT UpdateAppDomainEntryInIPC (AppDomain *pAppDomain);

void SendCreateAppDomainEvent(AppDomain * pAppDomain);
void SendExitAppDomainEvent (AppDomain *pAppDomain);

// Notify the debugger that an assembly has been loaded
void LoadAssembly(DomainAssembly * pDomainAssembly);
Expand Down
18 changes: 0 additions & 18 deletions src/coreclr/src/debug/inc/dacdbiinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,24 +309,6 @@ class IDacDbiInterface
virtual
VMPTR_OBJECTHANDLE GetAppDomainObject(VMPTR_AppDomain vmAppDomain) = 0;

//
// Determine if the specified AppDomain is the default domain
//
// Arguments:
// vmAppDomain - VM pointer to the AppDomain ojbect of interest
//
// Return Value:
// TRUE if this is the default appdomain, else FALSE.
//
// Notes:
// The default domain is the only one which cannot be unloaded and exists for the life
// of the process.
// A well behaved target only has 1 default domain.
//
virtual
BOOL IsDefaultDomain(VMPTR_AppDomain vmAppDomain) = 0;


virtual
void GetAssemblyFromDomainAssembly(VMPTR_DomainAssembly vmDomainAssembly, OUT VMPTR_Assembly * vmAssembly) = 0;

Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/src/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -955,8 +955,6 @@ class BaseDomain

virtual BOOL IsAppDomain() { LIMITED_METHOD_DAC_CONTRACT; return FALSE; }

BOOL IsDefaultDomain() { LIMITED_METHOD_DAC_CONTRACT; return TRUE; }

PTR_LoaderAllocator GetLoaderAllocator();
virtual PTR_AppDomain AsAppDomain()
{
Expand Down
8 changes: 0 additions & 8 deletions src/coreclr/src/vm/domainfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,14 +825,6 @@ void DomainFile::ClearNativeImageStress()
if (g_pConfig->RequireZaps() != EEConfig::REQUIRE_ZAPS_NONE)
return;

// Its OK to ClearNativeImage even for a shared assembly, as the current PEFile will
// be discarded if we decide to share the assembly. However, we always use the same
// PEFile for the system assembly. So discarding the native image in the current
// AppDomain will actually affect the system assembly in the shared domain, and other
// appdomains may have already committed to using its ngen image.
if (GetFile()->IsSystem() && !this->GetAppDomain()->IsDefaultDomain())
return;

if (g_IBCLogger.InstrEnabled())
return;

Expand Down
5 changes: 0 additions & 5 deletions src/coreclr/src/vm/finalizerthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ VOID FinalizerThread::FinalizerThreadWorker(void *args)
}

FinalizeAllObjects(0);
_ASSERTE(GetFinalizerThread()->GetDomain()->IsDefaultDomain());

// We may still have the finalizer thread for abort. If so the abort request is for previous finalizer method, not for next one.
if (GetFinalizerThread()->IsAbortRequested())
Expand Down Expand Up @@ -377,8 +376,6 @@ DWORD WINAPI FinalizerThread::FinalizerThreadStart(void *args)

LOG((LF_GC, LL_INFO10, "Finalizer thread starting...\n"));

_ASSERTE(GetFinalizerThread()->GetDomain()->IsDefaultDomain());

#if defined(FEATURE_COMINTEROP_APARTMENT_SUPPORT) && !defined(FEATURE_COMINTEROP)
// Make sure the finalizer thread is set to MTA to avoid hitting
// DevDiv Bugs 180773 - [Stress Failure] AV at CoreCLR!SafeQueryInterfaceHelper
Expand Down Expand Up @@ -440,8 +437,6 @@ DWORD WINAPI FinalizerThread::FinalizerThreadStart(void *args)
#endif
UNINSTALL_UNHANDLED_MANAGED_EXCEPTION_TRAP;
}
// finalizer should always park in default domain
_ASSERTE(GetThread()->GetDomain()->IsDefaultDomain());

LOG((LF_GC, LL_INFO10, "Finalizer thread done."));

Expand Down
4 changes: 0 additions & 4 deletions src/coreclr/src/vm/threadsuspend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2698,10 +2698,6 @@ void Thread::PreWorkForThreadAbort()
ResetUserInterrupted();

if (IsRudeAbort()) {
AppDomain *pDomain = GetAppDomain();
// Cannot enable the following assertion.
// We may take the lock, but the lock will be released during exception backout.
//_ASSERTE(!pDomain->IsDefaultDomain());
EPolicyAction action = GetEEPolicy()->GetDefaultAction(OPR_ThreadRudeAbortInCriticalRegion, this);
switch (action)
{
Expand Down
32 changes: 7 additions & 25 deletions src/coreclr/src/vm/virtualcallstub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,26 +536,13 @@ void VirtualCallStubManager::Init(BaseDomain *pDomain, LoaderAllocator *pLoaderA
// in order to minimize the fragmentation of our rangelists
//

if (parentDomain->IsDefaultDomain())
{
indcell_heap_commit_size = 16; indcell_heap_reserve_size = 2000;
cache_entry_heap_commit_size = 16; cache_entry_heap_reserve_size = 800;
indcell_heap_commit_size = 16; indcell_heap_reserve_size = 2000;
cache_entry_heap_commit_size = 16; cache_entry_heap_reserve_size = 800;

lookup_heap_commit_size = 24; lookup_heap_reserve_size = 250;
dispatch_heap_commit_size = 24; dispatch_heap_reserve_size = 600;
resolve_heap_commit_size = 24; resolve_heap_reserve_size = 300;
vtable_heap_commit_size = 24; vtable_heap_reserve_size = 600;
}
else
{
indcell_heap_commit_size = 8; indcell_heap_reserve_size = 8;
cache_entry_heap_commit_size = 8; cache_entry_heap_reserve_size = 8;

lookup_heap_commit_size = 8; lookup_heap_reserve_size = 8;
dispatch_heap_commit_size = 8; dispatch_heap_reserve_size = 8;
resolve_heap_commit_size = 8; resolve_heap_reserve_size = 8;
vtable_heap_commit_size = 8; vtable_heap_reserve_size = 8;
}
lookup_heap_commit_size = 24; lookup_heap_reserve_size = 250;
dispatch_heap_commit_size = 24; dispatch_heap_reserve_size = 600;
resolve_heap_commit_size = 24; resolve_heap_reserve_size = 300;
vtable_heap_commit_size = 24; vtable_heap_reserve_size = 600;

#ifdef HOST_64BIT
// If we're on 64-bit, there's a ton of address space, so reserve more space to
Expand Down Expand Up @@ -1042,7 +1029,7 @@ BOOL VirtualCallStubManager::CheckIsStub_Internal(PCODE stubStartAddress)
BOOL fIsOwner = isStub(stubStartAddress);

#if defined(TARGET_X86) && defined(FEATURE_PREJIT)
if (!fIsOwner && parentDomain->IsDefaultDomain())
if (!fIsOwner)
{
fIsOwner = (stubStartAddress == GetEEFuncEntryPoint(StubDispatchFixupStub));
}
Expand Down Expand Up @@ -3093,18 +3080,13 @@ void VirtualCallStubManager::LogStats()
return;
}

BOOL isDefault = parentDomain->IsDefaultDomain();

// Temp space to use for formatting the output.
static const int FMT_STR_SIZE = 160;
char szPrintStr[FMT_STR_SIZE];
DWORD dwWriteByte;

if (g_hStubLogFile && (stats.site_write != 0))
{
sprintf_s(szPrintStr, COUNTOF(szPrintStr), "\r\nStats for %s Manager\r\n", isDefault ? "the Default" : "an Unshared");
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);

//output counters
sprintf_s(szPrintStr, COUNTOF(szPrintStr), OUTPUT_FORMAT_INT, "site_counter", stats.site_counter);
WriteFile (g_hStubLogFile, szPrintStr, (DWORD) strlen(szPrintStr), &dwWriteByte, NULL);
Expand Down