Skip to content
Draft
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
60 changes: 10 additions & 50 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1752,12 +1752,7 @@ void DebuggerStartUp::WaitForContinueNotification()
//---------------------------------------------------------------------------------------
HRESULT Debugger::Startup(void)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
}
CONTRACTL_END;
STANDARD_VM_CONTRACT;

HRESULT hr = S_OK;

Expand Down Expand Up @@ -1917,12 +1912,7 @@ HRESULT Debugger::Startup(void)
//---------------------------------------------------------------------------------------
HRESULT Debugger::StartupPhase2(Thread * pThread)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
}
CONTRACTL_END;
STANDARD_VM_CONTRACT;

HRESULT hr = S_OK;

Expand Down Expand Up @@ -1956,35 +1946,6 @@ HRESULT Debugger::StartupPhase2(Thread * pThread)
return hr;
}


//---------------------------------------------------------------------------------------
//
// Public entrypoint into the debugger to force the lazy data to be initialized at a
// controlled point in time. This is useful for those callers into the debugger (e.g.,
// ETW rundown) that know they will need the lazy data initialized but cannot afford to
// have it initialized unpredictably or inside a lock.
//
// This may be called more than once, and will know to initialize the lazy data only
// once.
//

void Debugger::InitializeLazyDataIfNecessary()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
}
CONTRACTL_END;

if (!HasLazyData())
{
DebuggerLockHolder lockHolder(this);
LazyInit(); // throws
}
}


/******************************************************************************
Lazy initialize stuff once we know we are debugging.
This reduces the startup cost in the non-debugging case.
Expand Down Expand Up @@ -2839,8 +2800,7 @@ HRESULT Debugger::GetILToNativeMapping(PCODE pNativeCodeStartAddress, ULONG32 cM
//
// Notes:
// * This function assumes lazy data has already been initialized (in order to
// ensure that this doesn't trigger or take the large debugger mutex). So
// callers must guarantee they call InitializeLazyDataIfNecessary() first.
// ensure that this doesn't trigger or take the large debugger mutex).
// * Either this function fails, and (*prguiILOffset) & (*prguiNativeOffset) will be
// untouched OR this function succeeds and (*prguiILOffset) & (*prguiNativeOffset)
// will both be non-NULL, set to the parallel arrays this function allocated.
Expand Down Expand Up @@ -2877,8 +2837,6 @@ HRESULT Debugger::GetILToNativeMappingIntoArrays(
_ASSERTE(prguiNativeOffset != NULL);
_ASSERTE(pNativeCodeStartAddress != (PCODE)NULL);

// Any caller of GetILToNativeMappingIntoArrays had better call
// InitializeLazyDataIfNecessary first!
_ASSERTE(HasLazyData());

// Get the JIT info by functionId.
Expand Down Expand Up @@ -3137,6 +3095,7 @@ void Debugger::getBoundaries(MethodDesc * md,
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -8674,9 +8633,7 @@ void Debugger::SendUserBreakpoint(Thread * thread)
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_PREEMPTIVE;
STANDARD_VM_CHECK;

PRECONDITION(thread != NULL);
PRECONDITION(thread == ::GetThreadNULLOk());
Expand Down Expand Up @@ -11671,6 +11628,7 @@ TypeHandle Debugger::TypeDataWalk::ReadTypeHandle()
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -13906,8 +13864,9 @@ void Debugger::SendLogMessage(int iLevel,
{
CONTRACTL
{
GC_TRIGGERS;
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -13997,8 +13956,9 @@ void Debugger::SendCustomDebuggerNotification(Thread * pThread,
{
CONTRACTL
{
GC_TRIGGERS;
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/debug/ee/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -1879,8 +1879,6 @@ class Debugger : public DebugInterface

void CleanupTransportSocket();

void InitializeLazyDataIfNecessary();

void LazyInit(); // will throw
HRESULT LazyInitWrapper(); // calls LazyInit and converts to HR.

Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/debug/ee/funceval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ static void ValidateFuncEvalReturnType(DebuggerIPCE_FuncEvalType evalType, Metho
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -477,6 +478,7 @@ static void SetRegisterValue(DebuggerEval *pDE, CorDebugRegister reg, CORDB_ADDR
CONTRACTL
{
THROWS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -1662,6 +1664,7 @@ void ResolveFuncEvalGenericArgInfo(DebuggerEval *pDE)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down
7 changes: 1 addition & 6 deletions src/coreclr/inc/nibblestream.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,7 @@ class NibbleWriter

void WriteUnencodedU32(uint32_t x)
{
CONTRACTL
{
THROWS;
GC_NOTRIGGER;
}
CONTRACTL_END;
WRAPPER_NO_CONTRACT;

for (int i = 0; i < 8; i++)
{
Expand Down
6 changes: 6 additions & 0 deletions src/coreclr/utilcode/sigbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ void SigBuilder::Grow(SIZE_T cbMin)

SigBuilder::~SigBuilder()
{
CONTRACTL
{
NOTHROW;
}
CONTRACTL_END;

if (m_pBuffer != m_prealloc)
delete [] m_pBuffer;
}
Expand Down
8 changes: 6 additions & 2 deletions src/coreclr/vm/appdomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2931,6 +2931,7 @@ BOOL AppDomain::RemoveFileFromCache(PEAssembly * pPEAssembly)
CONTRACTL
{
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(CheckPointer(pPEAssembly));
}
CONTRACTL_END;
Expand Down Expand Up @@ -3798,10 +3799,13 @@ PTR_LoaderAllocator AppDomain::GetLoaderAllocator()

//------------------------------------------------------------------------
UINT32 AppDomain::GetTypeID(PTR_MethodTable pMT) {
CONTRACTL {
CONTRACTL
{
THROWS;
GC_TRIGGERS;
} CONTRACTL_END;
MODE_ANY;
}
CONTRACTL_END;

return m_typeIDMap.GetTypeID(pMT, true);
}
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/vm/assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,7 @@ BOOL Assembly::GetResource(LPCSTR szName, DWORD *cbResource,
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down Expand Up @@ -1932,6 +1933,7 @@ void Assembly::RequireLoadLevel(FileLoadLevel targetLevel)
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand All @@ -1951,6 +1953,7 @@ void Assembly::SetError(Exception *ex)
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_ANY;
}
CONTRACTL_END;

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/vm/assembly.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ class FriendAssemblyDescriptor
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(CheckPointer(pAccessingAssembly));
}
CONTRACTL_END;
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/vm/binder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ PTR_MethodTable CoreLibBinder::LookupClassLocal(BinderClassID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != CLASS__NIL);
PRECONDITION(id <= m_cClasses);
Expand Down Expand Up @@ -126,6 +127,7 @@ MethodDesc * CoreLibBinder::LookupMethodLocal(BinderMethodID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != METHOD__NIL);
PRECONDITION(id <= m_cMethods);
Expand Down Expand Up @@ -184,6 +186,7 @@ FieldDesc * CoreLibBinder::LookupFieldLocal(BinderFieldID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != FIELD__NIL);
PRECONDITION(id <= m_cFields);
Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/vm/binder.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ FORCEINLINE PTR_MethodTable CoreLibBinder::GetClass(BinderClassID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != CLASS__NIL);
PRECONDITION((&g_CoreLib)->m_cClasses > 0); // Make sure CoreLib has been loaded.
Expand All @@ -354,6 +355,7 @@ FORCEINLINE MethodDesc * CoreLibBinder::GetMethod(BinderMethodID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != METHOD__NIL);
PRECONDITION(id <= (&g_CoreLib)->m_cMethods);
Expand All @@ -375,6 +377,7 @@ FORCEINLINE FieldDesc * CoreLibBinder::GetField(BinderFieldID id)
{
THROWS;
GC_TRIGGERS;
MODE_ANY;

PRECONDITION(id != FIELD__NIL);
PRECONDITION(id <= (&g_CoreLib)->m_cFields);
Expand Down
16 changes: 2 additions & 14 deletions src/coreclr/vm/callcounting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -739,13 +739,7 @@ COUNT_T CallCountingManager::GetCountOfCodeVersionsPendingCompletion()

void CallCountingManager::CompleteCallCounting()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
STANDARD_VM_CONTRACT;

_ASSERTE(GetThreadNULLOk() == TieredCompilationManager::GetBackgroundWorkerThread());

Expand Down Expand Up @@ -851,13 +845,7 @@ void CallCountingManager::CompleteCallCounting()

void CallCountingManager::StopAndDeleteAllCallCountingStubs()
{
CONTRACTL
{
THROWS;
GC_TRIGGERS;
MODE_PREEMPTIVE;
}
CONTRACTL_END;
STANDARD_VM_CONTRACT;

_ASSERTE(GetThreadNULLOk() == TieredCompilationManager::GetBackgroundWorkerThread());

Expand Down
7 changes: 5 additions & 2 deletions src/coreclr/vm/callhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,13 @@ void CallDescrWorker(CallDescrData * pCallDescrData)
// out-of-order destruction of the contract object, resulting in very odd crashes later.
//
#if 0
CONTRACTL {
CONTRACTL
{
THROWS;
GC_TRIGGERS;
} CONTRACTL_END;
MODE_ANY;
}
CONTRACTL_END;
#endif // 0
STATIC_CONTRACT_THROWS;
STATIC_CONTRACT_GC_TRIGGERS;
Expand Down
8 changes: 2 additions & 6 deletions src/coreclr/vm/ceeload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2020,9 +2020,7 @@ void Module::AddClass(mdTypeDef classdef)
CONTRACTL
{
INSTANCE_CHECK;
THROWS;
GC_TRIGGERS;
MODE_PREEMPTIVE;
STANDARD_VM_CHECK;
}
CONTRACTL_END;

Expand Down Expand Up @@ -3095,9 +3093,7 @@ mdToken GetTokenForVTableEntry(HINSTANCE hInst, BYTE **ppVTEntry)
//=================================================================================
void SetTargetForVTableEntry(HINSTANCE hInst, BYTE **ppVTEntry, BYTE *pTarget)
{
CONTRACTL{
THROWS;
} CONTRACTL_END;
STANDARD_VM_CONTRACT;

DWORD oldProtect;
if (!ClrVirtualProtect(ppVTEntry, sizeof(BYTE*), PAGE_READWRITE, &oldProtect))
Expand Down
8 changes: 2 additions & 6 deletions src/coreclr/vm/class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1679,9 +1679,7 @@ void TypeHandle::NotifyDebuggerUnload() const
MethodDesc* MethodTable::GetBoxedEntryPointMD(MethodDesc *pMD)
{
CONTRACTL {
MODE_PREEMPTIVE;
THROWS;
GC_TRIGGERS;
STANDARD_VM_CHECK;
PRECONDITION(IsValueType());
PRECONDITION(!pMD->ContainsGenericVariables());
PRECONDITION(!pMD->IsUnboxingStub());
Expand All @@ -1701,9 +1699,7 @@ MethodDesc* MethodTable::GetBoxedEntryPointMD(MethodDesc *pMD)
MethodDesc* MethodTable::GetUnboxedEntryPointMD(MethodDesc *pMD)
{
CONTRACTL {
MODE_PREEMPTIVE;
THROWS;
GC_TRIGGERS;
STANDARD_VM_CHECK;
PRECONDITION(IsValueType());
// reflection needs to call this for methods in non instantiated classes,
// so move the assert to the caller when needed
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/vm/clsload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4046,6 +4046,7 @@ static BOOL AssemblyOrFriendAccessAllowed(Assembly *pAccessingAssembly,
{
THROWS;
GC_TRIGGERS;
MODE_ANY;
PRECONDITION(CheckPointer(pAccessingAssembly));
PRECONDITION(CheckPointer(pTargetAssembly));
}
Expand Down
Loading
Loading