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
44 changes: 1 addition & 43 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2778,7 +2778,7 @@ void AppDomain::SetFriendlyName(LPCWSTR pwzFriendlyName)
CONTRACTL
{
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS; // for NameChangeEvent
MODE_ANY;
INJECT_FAULT(COMPlusThrowOM(););
}
Expand Down Expand Up @@ -2830,48 +2830,6 @@ LPCWSTR AppDomain::GetFriendlyName()

#ifndef DACCESS_COMPILE

LPCWSTR AppDomain::GetFriendlyNameForDebugger()
{
CONTRACT (LPCWSTR)
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
MODE_ANY;
POSTCONDITION(CheckPointer(RETVAL));
}
CONTRACT_END;


if (m_friendlyName == NULL)
{
BOOL fSuccess = FALSE;

EX_TRY
{
SetFriendlyName(NULL);

fSuccess = TRUE;
}
EX_CATCH
{
// Gobble all exceptions.
}
EX_END_CATCH

if (!fSuccess)
{
RETURN W("");
}
}

RETURN m_friendlyName;
}


#endif // !DACCESS_COMPILE

#ifndef DACCESS_COMPILE

BOOL AppDomain::AddFileToCache(AssemblySpec* pSpec, PEAssembly * pPEAssembly)
{
CONTRACTL
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/vm/appdomain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,6 @@ class AppDomain final

//****************************************************************************************
LPCWSTR GetFriendlyName();
LPCWSTR GetFriendlyNameForDebugger();
void SetFriendlyName(LPCWSTR pwzFriendlyName);

PEAssembly * BindAssemblySpec(
Expand Down
14 changes: 7 additions & 7 deletions src/coreclr/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ HRESULT CorHost2::Stop()
{
NOTHROW;
ENTRY_POINT; // We're bringing the EE down, so no point in probing
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
}
CONTRACTL_END;
if (!g_fEEStarted)
Expand Down Expand Up @@ -491,7 +491,7 @@ HRESULT CorHost2::ExecuteInAppDomain(DWORD dwAppDomainId,
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand Down Expand Up @@ -527,7 +527,7 @@ HRESULT CorHost2::CreateAppDomainWithManager(
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand Down Expand Up @@ -686,7 +686,7 @@ HRESULT CorHost2::CreateDelegate(
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand Down Expand Up @@ -770,7 +770,7 @@ HRESULT CorHost2::Authenticate(ULONGLONG authKey)
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand All @@ -784,7 +784,7 @@ HRESULT CorHost2::RegisterMacEHPort()
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand All @@ -797,7 +797,7 @@ HRESULT CorHost2::SetStartupFlags(STARTUP_FLAGS flag)
CONTRACTL
{
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
ENTRY_POINT; // This is called by a host.
}
CONTRACTL_END;
Expand Down
69 changes: 31 additions & 38 deletions src/coreclr/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ DWORD Thread::JoinEx(DWORD timeout, WaitMode mode)
{
CONTRACTL {
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS; // For DoAppropriateWait
}
CONTRACTL_END;

Expand Down Expand Up @@ -583,7 +583,7 @@ static void DeleteThread(Thread* pThread)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
}
CONTRACTL_END;

Expand Down Expand Up @@ -628,7 +628,7 @@ Thread* SetupThread()
{
CONTRACTL {
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -773,7 +773,7 @@ Thread* SetupThreadNoThrow(HRESULT *pHR)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
if (GetThreadNULLOk()) {DISABLED(GC_NOTRIGGER);} else {GC_TRIGGERS;}
}
CONTRACTL_END;

Expand Down Expand Up @@ -824,7 +824,7 @@ Thread* SetupUnstartedThread(SetupUnstartedThreadFlags flags)
{
CONTRACTL {
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -1305,7 +1305,7 @@ Thread::Thread()
{
CONTRACTL {
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -1543,7 +1543,7 @@ void Thread::InitThread()
{
CONTRACTL {
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
}
CONTRACTL_END;

Expand Down Expand Up @@ -2198,7 +2198,7 @@ int Thread::IncExternalCount()
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
}
CONTRACTL_END;

Expand Down Expand Up @@ -2229,7 +2229,7 @@ int Thread::DecExternalCount(BOOL holdingLock)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -2394,7 +2394,7 @@ Thread::~Thread()
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -2670,7 +2670,7 @@ void Thread::CleanupCOMState()
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down Expand Up @@ -2768,7 +2768,7 @@ void Thread::OnThreadTerminate(BOOL holdingLock)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS; // For DecExternalCount & other calls
}
CONTRACTL_END;

Expand Down Expand Up @@ -4053,35 +4053,28 @@ void Thread::SetExposedObject(OBJECTREF exposed)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
MODE_COOPERATIVE;
}
CONTRACTL_END;

if (exposed != NULL)
{
_ASSERTE (GetThreadNULLOk() != this);
_ASSERTE(IsUnstarted());
_ASSERTE(ObjectFromHandle(m_ExposedObject) == NULL);
// The exposed object keeps us alive until it is GC'ed. This doesn't mean the
// physical thread continues to run, of course.
StoreObjectInHandle(m_ExposedObject, exposed);
// This makes sure the contexts on the backing thread
// and the managed thread start off in sync with each other.
// BEWARE: the IncExternalCount call below may cause GC to happen.
_ASSERTE(exposed);

// IncExternalCount will store exposed in m_StrongHndToExposedObject which is in default domain.
// If the creating thread is killed before the target thread is killed in Thread.Start, Thread object
// will be kept alive forever.
// Instead, IncExternalCount should be called after the target thread has been started in Thread.Start.
// IncExternalCount();
}
else
{
// Simply set both of the handles to NULL. The GC of the old exposed thread
// object will take care of decrementing the external ref count.
StoreObjectInHandle(m_ExposedObject, NULL);
StoreObjectInHandle(m_StrongHndToExposedObject, NULL);
}
_ASSERTE(GetThreadNULLOk() != this);
_ASSERTE(IsUnstarted());
_ASSERTE(ObjectFromHandle(m_ExposedObject) == NULL);
// The exposed object keeps us alive until it is GC'ed. This doesn't mean the
// physical thread continues to run, of course.
StoreObjectInHandle(m_ExposedObject, exposed);
// This makes sure the contexts on the backing thread
// and the managed thread start off in sync with each other.
// BEWARE: the IncExternalCount call below may cause GC to happen.

// IncExternalCount will store exposed in m_StrongHndToExposedObject which is in default domain.
// If the creating thread is killed before the target thread is killed in Thread.Start, Thread object
// will be kept alive forever.
// Instead, IncExternalCount should be called after the target thread has been started in Thread.Start.
// IncExternalCount();
}

void Thread::SetLastThrownObject(OBJECTREF throwable, BOOL isUnhandled)
Expand Down Expand Up @@ -4931,7 +4924,7 @@ void ThreadStore::AddThread(Thread *newThread)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS;
}
CONTRACTL_END;

Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/vm/threadsuspend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ Thread::UserAbort(EEPolicy::ThreadAbortTypes abortType, DWORD timeout)
CONTRACTL
{
THROWS;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_TRIGGERS; // For GetXxxException
}
CONTRACTL_END;

Expand Down Expand Up @@ -3590,7 +3590,7 @@ void ThreadSuspend::ResumeAllThreads(BOOL SuspendSucceeded)
{
CONTRACTL {
NOTHROW;
if (GetThreadNULLOk()) {GC_TRIGGERS;} else {DISABLED(GC_NOTRIGGER);}
GC_NOTRIGGER;
}
CONTRACTL_END;

Expand Down
Loading