Skip to content

Commit

Permalink
trying to hide JitHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
VSadov committed Dec 28, 2019
1 parent 069f677 commit 20f7a30
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ private static CastResult ObjIsInstanceOfCached(object obj, void* toTypeHnd)
// IsInstanceOf test used for unusual cases (naked type parameters, variant generic types)
// Unlike the IsInstanceOfInterface, IsInstanceOfClass, and IsIsntanceofArray functions,
// this test must deal with all kinds of type tests
[DebuggerStepThrough]
[DebuggerHidden]
private static object? JIT_IsInstanceOfAny(void* toTypeHnd, object? obj)
{
CastResult result;
Expand All @@ -199,6 +201,8 @@ private static CastResult ObjIsInstanceOfCached(object obj, void* toTypeHnd)
// ChkCast test used for unusual cases (naked type parameters, variant generic types)
// Unlike the ChkCastInterface, ChkCastClass, and ChkCastArray functions,
// this test must deal with all kinds of type tests
[DebuggerStepThrough]
[DebuggerHidden]
private static object? JIT_ChkCastAny(void* toTypeHnd, object? obj)
{
CastResult result;
Expand Down
9 changes: 9 additions & 0 deletions src/coreclr/src/debug/daccess/dacdbiimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5504,6 +5504,15 @@ IDacDbiInterface::DynamicMethodType DacDbiInterfaceImpl::IsILStubOrLCGMethod(VMP
}
}

bool DacDbiInterfaceImpl::IsJitHelper(VMPTR_MethodDesc vmMethodDesc)
{
DD_ENTER_MAY_THROW;

MethodDesc * pMD = vmMethodDesc.GetDacPtr();

return pMD->IsJitHelper();
}

//---------------------------------------------------------------------------------------
//
// Determine whether the specified thread is at a GC safe place.
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/src/debug/daccess/dacdbiimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,8 @@ class DacDbiInterfaceImpl :
// Check if the given method is an IL stub or an LCD method.
DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc);

bool IsJitHelper(VMPTR_MethodDesc vmMethodDesc);

// Return a TargetBuffer for the raw vararg signature.
TargetBuffer GetVarArgSig(CORDB_ADDRESS VASigCookieAddr,
CORDB_ADDRESS * pArgBase);
Expand Down
3 changes: 2 additions & 1 deletion src/coreclr/src/debug/di/rsstackwalk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ HRESULT CordbStackWalk::GetFrameWorker(ICorDebugFrame ** ppFrame)
// modified method, but at least the error won't leak out to interfere with inspection
// of the callstack as a whole.
if (!frameData.v.fNoMetadata &&
pNativeCode->GetFunction()->IsNativeImpl() != CordbFunction::kNativeOnly)
pNativeCode->GetFunction()->IsNativeImpl() != CordbFunction::kNativeOnly &&
!pDAC->IsJitHelper(pNativeCode->GetVMNativeCodeMethodDescToken()))
{
pNativeCode->LoadNativeInfo();

Expand Down
3 changes: 3 additions & 0 deletions src/coreclr/src/debug/inc/dacdbiinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,9 @@ class IDacDbiInterface
virtual
DynamicMethodType IsILStubOrLCGMethod(VMPTR_MethodDesc vmMethodDesc) = 0;

virtual
bool IsJitHelper(VMPTR_MethodDesc vmMethodDesc) = 0;

//
// Return a TargetBuffer for the raw vararg signature.
// Also return the address of the first argument in the vararg signature.
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/src/vm/castcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ void CastCache::Initialize()
CONTRACTL_END;

MethodDesc* pMD = MscorlibBinder::GetMethod((BinderMethodID)(METHOD__CASTHELPERS__JIT_ISINSTANCEOFANY));
pMD->SetIsJitHelper();
PCODE pDest = pMD->GetMultiCallableAddrOfCode();
SetJitHelperFunction(CORINFO_HELP_ISINSTANCEOFANY, pDest);

pMD = MscorlibBinder::GetMethod((BinderMethodID)(METHOD__CASTHELPERS__JIT_CHKCASTANY));
pMD->SetIsJitHelper();
pDest = pMD->GetMultiCallableAddrOfCode();
SetJitHelperFunction(CORINFO_HELP_CHKCASTANY, pDest);

Expand Down
4 changes: 3 additions & 1 deletion src/coreclr/src/vm/excep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3518,7 +3518,9 @@ BOOL StackTraceInfo::AppendElement(BOOL bAllowAllocMem, UINT_PTR currentIP, UINT
LOG((LF_EH, LL_INFO10000, "StackTraceInfo::AppendElement (%p), IP = %p, SP = %p, %s::%s\n", this, currentIP, currentSP, pFunc ? pFunc->m_pszDebugClassName : "", pFunc ? pFunc->m_pszDebugMethodName : "" ));
BOOL bRetVal = FALSE;

if (pFunc != NULL && pFunc->IsILStub())
// TODO: WIP is this actually the right place?
// are there more places that should skip JIT helpers.
if (pFunc != NULL && (pFunc->IsILStub() || pFunc->IsJitHelper()))
return FALSE;

// Save this function in the stack trace array, which we only build on the first pass. We'll try to expand the
Expand Down
16 changes: 15 additions & 1 deletion src/coreclr/src/vm/method.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,9 @@ class MethodDesc

enum_flag2_IsEligibleForTieredCompilation = 0x20,

// unused = 0x40,
// for most purposes these are regular managed methods.
// We do not want this to appear in stack traces though.
enum_flag2_IsJitHelper = 0x40,
// unused = 0x80,
};
BYTE m_bFlags2;
Expand Down Expand Up @@ -1908,6 +1910,18 @@ class MethodDesc
m_bFlags2 |= enum_flag2_IsJitIntrinsic;
}

inline BOOL IsJitHelper()
{
LIMITED_METHOD_DAC_CONTRACT;
return (m_bFlags2 & enum_flag2_IsJitHelper) != 0;
}

inline void SetIsJitHelper()
{
LIMITED_METHOD_CONTRACT;
m_bFlags2 |= enum_flag2_IsJitHelper;
}

static const SIZE_T s_ClassificationSizeTable[];

static SIZE_T GetBaseSize(DWORD classification)
Expand Down

0 comments on commit 20f7a30

Please sign in to comment.