Skip to content
Merged
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
19 changes: 19 additions & 0 deletions src/coreclr/vm/reflectioninvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include "dbginterface.h"
#include "argdestination.h"

#include "interpexec.h"

extern "C" void QCALLTYPE RuntimeFieldHandle_GetValue(FieldDesc* fieldDesc, QCall::ObjectHandleOnStack instance, QCall::TypeHandle fieldType, QCall::TypeHandle declaringType, BOOL* pIsClassInitialized, QCall::ObjectHandleOnStack result)
{
QCALL_CONTRACT;
Expand Down Expand Up @@ -1362,6 +1364,23 @@ FCIMPL0(FC_BOOL_RET, ReflectionInvocation::TryEnsureSufficientExecutionStack)
UINT_PTR current = reinterpret_cast<UINT_PTR>(&pThread);
UINT_PTR limit = pThread->GetCachedStackSufficientExecutionLimit();

#ifdef FEATURE_INTERPRETER
InterpThreadContext* pInterpThreadContext = pThread->GetInterpThreadContext();
if (pInterpThreadContext != nullptr)
{
// The interpreter has its own stack, so we need to check against that too.
#ifdef HOST_64BIT
const UINT_PTR MinExecutionStackSize = 128 * 1024;
#else // !HOST_64BIT
const UINT_PTR MinExecutionStackSize = 64 * 1024;
#endif // HOST_64BIT
if (pInterpThreadContext->pStackPointer >= pInterpThreadContext->pStackEnd - MinExecutionStackSize)
{
FC_RETURN_BOOL(FALSE);
}
}
#endif // FEATURE_INTERPRETER

FC_RETURN_BOOL(current >= limit);
}
FCIMPLEND
Expand Down
Loading