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
51 changes: 0 additions & 51 deletions src/coreclr/src/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,9 +1418,6 @@ Thread::Thread()
m_CacheStackSufficientExecutionLimit = 0;
m_CacheStackStackAllocNonRiskyExecutionLimit = 0;

m_LastAllowableStackAddress= 0;
m_ProbeLimit = 0;

#ifdef _DEBUG
m_pCleanedStackBase = NULL;
#endif
Expand Down Expand Up @@ -1707,8 +1704,6 @@ BOOL Thread::InitThread()
if (m_CacheStackBase == 0)
{
_ASSERTE(m_CacheStackLimit == 0);
_ASSERTE(m_LastAllowableStackAddress == 0);
_ASSERTE(m_ProbeLimit == 0);
ret = SetStackLimits(fAll);
if (ret == FALSE)
{
Expand Down Expand Up @@ -6415,24 +6410,6 @@ BOOL Thread::SetStackLimits(SetStackLimitScope scope)
if (FAILED(CLRSetThreadStackGuarantee()))
return FALSE;

// Cache the last stack addresses that we are allowed to touch. We throw a stack overflow
// if we cross that line. Note that we ignore any subsequent calls to STSG for Whidbey until
// we see an exception and recache the values. We use the LastAllowableAddresses to
// determine if we've taken a hard SO and the ProbeLimits on the probes themselves.

m_LastAllowableStackAddress = GetLastNormalStackAddress();

if (g_pConfig->ProbeForStackOverflow())
{
m_ProbeLimit = m_LastAllowableStackAddress;
}
else
{
// If we have stack probing disabled, set the probeLimit to 0 so that all probes will pass. This
// way we don't have to do an extra check in the probe code.
m_ProbeLimit = 0;
}

return TRUE;
}

Expand Down Expand Up @@ -6685,34 +6662,6 @@ void Thread::DebugLogStackMBIs()
}
#endif // _DEBUG

//
// IsSPBeyondLimit
//
// Determines if the stack pointer is beyond the stack limit, in which case
// we can assume we've taken a hard SO.
//
// Parameters: none
//
// Returns: bool indicating if SP is beyond the limit or not
//
BOOL Thread::IsSPBeyondLimit()
{
WRAPPER_NO_CONTRACT;

// Reset the stack limits if necessary.
// @todo . Add a vectored handler for X86 so that we reset the stack limits
// there, as anything that supports SetThreadStackGuarantee will support vectored handlers.
// Then we can always assume during EH processing that our stack limits are good and we
// don't have to call ResetStackLimits.
ResetStackLimits();
char *approxSP = (char *)GetCurrentSP();
if (approxSP < (char *)(GetLastAllowableStackAddress()))
{
return TRUE;
}
return FALSE;
}

NOINLINE void AllocateSomeStack(){
LIMITED_METHOD_CONTRACT;
#ifdef TARGET_X86
Expand Down
22 changes: 0 additions & 22 deletions src/coreclr/src/vm/threads.h
Original file line number Diff line number Diff line change
Expand Up @@ -3222,16 +3222,6 @@ class Thread
static UINT_PTR GetLastNormalStackAddress(UINT_PTR stackBase);
UINT_PTR GetLastNormalStackAddress();

UINT_PTR GetLastAllowableStackAddress()
{
return m_LastAllowableStackAddress;
}

UINT_PTR GetProbeLimit()
{
return m_ProbeLimit;
}

void ResetStackLimits()
{
CONTRACTL
Expand All @@ -3248,8 +3238,6 @@ class Thread
SetStackLimits(fAllowableOnly);
}

BOOL IsSPBeyondLimit();

INDEBUG(static void DebugLogStackMBIs());

#if defined(_DEBUG_IMPL) && !defined(DACCESS_COMPILE)
Expand Down Expand Up @@ -3659,16 +3647,6 @@ class Thread

ThreadExceptionState m_ExceptionState;

//-----------------------------------------------------------
// For stack probing. These are the last allowable addresses that a thread
// can touch. Going beyond is a stack overflow. The ProbeLimit will be
// set based on whether SO probing is enabled. The LastAllowableAddress
// will always represent the true stack limit.
//-----------------------------------------------------------
UINT_PTR m_ProbeLimit;

UINT_PTR m_LastAllowableStackAddress;

private:
//---------------------------------------------------------------
// m_debuggerFilterContext holds the thread's "filter context" for the
Expand Down