Skip to content

Commit 297b0e3

Browse files
committed
Re-enable perf optimization for stackwalk scenairio in EECodeManager::GetAmbientSP
1 parent 36582c8 commit 297b0e3

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

src/coreclr/vm/eetwain.cpp

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,34 +2122,43 @@ TADDR EECodeManager::GetAmbientSP(PREGDISPLAY pContext,
21222122

21232123
/* Extract the necessary information from the info block header */
21242124

2125+
PTR_CBYTE table = nullptr;
21252126
hdrInfo hdrInfoBody = { 0 };
2126-
PTR_CBYTE table = pCodeInfo->DecodeGCHdrInfo(&hdrInfoBody, dwRelOffset);
2127+
hdrInfo *pCodeInfoBody = &hdrInfoBody;
2128+
if (pCodeInfo->GetRelOffset() == dwRelOffset)
2129+
{
2130+
table = pCodeInfo->DecodeGCHdrInfo(&pCodeInfoBody);
2131+
}
2132+
else
2133+
{
2134+
table = pCodeInfo->DecodeGCHdrInfo(&hdrInfoBody, dwRelOffset);
2135+
}
21272136

21282137
#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
21292138
if (trFixContext)
21302139
{
21312140
minipal_log_print_info("GetAmbientSP [%s][%s] for %s.%s: ",
2132-
hdrInfoBody.ebpFrame?"ebp":" ",
2133-
hdrInfoBody.interruptible?"int":" ",
2141+
pCodeInfoBody->ebpFrame?"ebp":" ",
2142+
pCodeInfoBody->interruptible?"int":" ",
21342143
"UnknownClass","UnknownMethod");
21352144
minipal_log_flush_info();
21362145
}
21372146
#endif // _DEBUG && !DACCESS_COMPILE
21382147

2139-
if ((hdrInfoBody.prologOffs != hdrInfo::NOT_IN_PROLOG) ||
2140-
(hdrInfoBody.epilogOffs != hdrInfo::NOT_IN_EPILOG))
2148+
if ((pCodeInfoBody->prologOffs != hdrInfo::NOT_IN_PROLOG) ||
2149+
(pCodeInfoBody->epilogOffs != hdrInfo::NOT_IN_EPILOG))
21412150
{
21422151
return NULL;
21432152
}
21442153

21452154
/* make sure that we have an ebp stack frame */
21462155

2147-
if (hdrInfoBody.handlers)
2156+
if (pCodeInfoBody->handlers)
21482157
{
2149-
_ASSERTE(hdrInfoBody.ebpFrame);
2158+
_ASSERTE(pCodeInfoBody->ebpFrame);
21502159

21512160
TADDR baseSP;
2152-
GetHandlerFrameInfo(&hdrInfoBody,
2161+
GetHandlerFrameInfo(pCodeInfoBody,
21532162
GetRegdisplayFP(pContext),
21542163
(DWORD) IGNORE_VAL,
21552164
nestingLevel,
@@ -2162,24 +2171,24 @@ TADDR EECodeManager::GetAmbientSP(PREGDISPLAY pContext,
21622171

21632172
_ASSERTE(nestingLevel == 0);
21642173

2165-
if (hdrInfoBody.ebpFrame)
2174+
if (pCodeInfoBody->ebpFrame)
21662175
{
2167-
return GetOutermostBaseFP(GetRegdisplayFP(pContext), &hdrInfoBody);
2176+
return GetOutermostBaseFP(GetRegdisplayFP(pContext), pCodeInfoBody);
21682177
}
21692178

21702179
TADDR baseSP = GetRegdisplaySP(pContext);
2171-
if (hdrInfoBody.interruptible)
2180+
if (pCodeInfoBody->interruptible)
21722181
{
2173-
baseSP += scanArgRegTableI(skipToArgReg(hdrInfoBody, table),
2182+
baseSP += scanArgRegTableI(skipToArgReg(*pCodeInfoBody, table),
21742183
dwRelOffset,
21752184
dwRelOffset,
2176-
&hdrInfoBody);
2185+
pCodeInfoBody);
21772186
}
21782187
else
21792188
{
2180-
baseSP += scanArgRegTable(skipToArgReg(hdrInfoBody, table),
2189+
baseSP += scanArgRegTable(skipToArgReg(*pCodeInfoBody, table),
21812190
dwRelOffset,
2182-
&hdrInfoBody);
2191+
pCodeInfoBody);
21832192
}
21842193

21852194
return baseSP;

0 commit comments

Comments
 (0)