Skip to content

Commit 395fe0c

Browse files
authored
Cleanup stack limits usage (#41946)
There were couple of members / functions for stack limits checking that were not used anymore.
1 parent 2182936 commit 395fe0c

File tree

2 files changed

+0
-73
lines changed

2 files changed

+0
-73
lines changed

src/coreclr/src/vm/threads.cpp

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,9 +1418,6 @@ Thread::Thread()
14181418
m_CacheStackSufficientExecutionLimit = 0;
14191419
m_CacheStackStackAllocNonRiskyExecutionLimit = 0;
14201420

1421-
m_LastAllowableStackAddress= 0;
1422-
m_ProbeLimit = 0;
1423-
14241421
#ifdef _DEBUG
14251422
m_pCleanedStackBase = NULL;
14261423
#endif
@@ -1707,8 +1704,6 @@ BOOL Thread::InitThread()
17071704
if (m_CacheStackBase == 0)
17081705
{
17091706
_ASSERTE(m_CacheStackLimit == 0);
1710-
_ASSERTE(m_LastAllowableStackAddress == 0);
1711-
_ASSERTE(m_ProbeLimit == 0);
17121707
ret = SetStackLimits(fAll);
17131708
if (ret == FALSE)
17141709
{
@@ -6415,24 +6410,6 @@ BOOL Thread::SetStackLimits(SetStackLimitScope scope)
64156410
if (FAILED(CLRSetThreadStackGuarantee()))
64166411
return FALSE;
64176412

6418-
// Cache the last stack addresses that we are allowed to touch. We throw a stack overflow
6419-
// if we cross that line. Note that we ignore any subsequent calls to STSG for Whidbey until
6420-
// we see an exception and recache the values. We use the LastAllowableAddresses to
6421-
// determine if we've taken a hard SO and the ProbeLimits on the probes themselves.
6422-
6423-
m_LastAllowableStackAddress = GetLastNormalStackAddress();
6424-
6425-
if (g_pConfig->ProbeForStackOverflow())
6426-
{
6427-
m_ProbeLimit = m_LastAllowableStackAddress;
6428-
}
6429-
else
6430-
{
6431-
// If we have stack probing disabled, set the probeLimit to 0 so that all probes will pass. This
6432-
// way we don't have to do an extra check in the probe code.
6433-
m_ProbeLimit = 0;
6434-
}
6435-
64366413
return TRUE;
64376414
}
64386415

@@ -6685,34 +6662,6 @@ void Thread::DebugLogStackMBIs()
66856662
}
66866663
#endif // _DEBUG
66876664

6688-
//
6689-
// IsSPBeyondLimit
6690-
//
6691-
// Determines if the stack pointer is beyond the stack limit, in which case
6692-
// we can assume we've taken a hard SO.
6693-
//
6694-
// Parameters: none
6695-
//
6696-
// Returns: bool indicating if SP is beyond the limit or not
6697-
//
6698-
BOOL Thread::IsSPBeyondLimit()
6699-
{
6700-
WRAPPER_NO_CONTRACT;
6701-
6702-
// Reset the stack limits if necessary.
6703-
// @todo . Add a vectored handler for X86 so that we reset the stack limits
6704-
// there, as anything that supports SetThreadStackGuarantee will support vectored handlers.
6705-
// Then we can always assume during EH processing that our stack limits are good and we
6706-
// don't have to call ResetStackLimits.
6707-
ResetStackLimits();
6708-
char *approxSP = (char *)GetCurrentSP();
6709-
if (approxSP < (char *)(GetLastAllowableStackAddress()))
6710-
{
6711-
return TRUE;
6712-
}
6713-
return FALSE;
6714-
}
6715-
67166665
NOINLINE void AllocateSomeStack(){
67176666
LIMITED_METHOD_CONTRACT;
67186667
#ifdef TARGET_X86

src/coreclr/src/vm/threads.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3222,16 +3222,6 @@ class Thread
32223222
static UINT_PTR GetLastNormalStackAddress(UINT_PTR stackBase);
32233223
UINT_PTR GetLastNormalStackAddress();
32243224

3225-
UINT_PTR GetLastAllowableStackAddress()
3226-
{
3227-
return m_LastAllowableStackAddress;
3228-
}
3229-
3230-
UINT_PTR GetProbeLimit()
3231-
{
3232-
return m_ProbeLimit;
3233-
}
3234-
32353225
void ResetStackLimits()
32363226
{
32373227
CONTRACTL
@@ -3248,8 +3238,6 @@ class Thread
32483238
SetStackLimits(fAllowableOnly);
32493239
}
32503240

3251-
BOOL IsSPBeyondLimit();
3252-
32533241
INDEBUG(static void DebugLogStackMBIs());
32543242

32553243
#if defined(_DEBUG_IMPL) && !defined(DACCESS_COMPILE)
@@ -3659,16 +3647,6 @@ class Thread
36593647

36603648
ThreadExceptionState m_ExceptionState;
36613649

3662-
//-----------------------------------------------------------
3663-
// For stack probing. These are the last allowable addresses that a thread
3664-
// can touch. Going beyond is a stack overflow. The ProbeLimit will be
3665-
// set based on whether SO probing is enabled. The LastAllowableAddress
3666-
// will always represent the true stack limit.
3667-
//-----------------------------------------------------------
3668-
UINT_PTR m_ProbeLimit;
3669-
3670-
UINT_PTR m_LastAllowableStackAddress;
3671-
36723650
private:
36733651
//---------------------------------------------------------------
36743652
// m_debuggerFilterContext holds the thread's "filter context" for the

0 commit comments

Comments
 (0)