Skip to content

Commit 581cdcd

Browse files
committed
Cleanup, reflecting feedback and fixing one last issue
1 parent 0d71a2f commit 581cdcd

File tree

4 files changed

+18
-21
lines changed

4 files changed

+18
-21
lines changed

src/coreclr/inc/gcinfodecoder.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ enum ICodeManagerFlags
186186
NoReportUntracked
187187
= 0x0080, // EnumGCRefs/EnumerateLiveSlots should *not* include
188188
// any untracked slots
189+
ReportFPBasedSlotsOnly = 0, // Unused by nativeaot, the gc info decoder checks that. Set to 0 to let the compiler optimize out the related code.
189190
};
190191

191192
#endif // !_strike_h
@@ -675,11 +676,12 @@ class GcInfoDecoder
675676
{
676677
_ASSERTE(slotIndex < slotDecoder.GetNumSlots());
677678
const GcSlotDesc* pSlot = slotDecoder.GetSlotDesc(slotIndex);
679+
bool reportFpBasedSlotsOnly = (inputFlags & ReportFPBasedSlotsOnly);
678680

679681
if(slotIndex < slotDecoder.GetNumRegisters())
680682
{
681683
UINT32 regNum = pSlot->Slot.RegisterNumber;
682-
if( reportScratchSlots || !IsScratchRegister( regNum, pRD ) )
684+
if( reportScratchSlots || !IsScratchRegister( regNum, pRD ) && !reportFpBasedSlotsOnly )
683685
{
684686
ReportRegisterToGC(
685687
regNum,
@@ -699,7 +701,9 @@ class GcInfoDecoder
699701
{
700702
INT32 spOffset = pSlot->Slot.Stack.SpOffset;
701703
GcStackSlotBase spBase = pSlot->Slot.Stack.Base;
702-
if( reportScratchSlots || !IsScratchStackSlot(spOffset, spBase, pRD) )
704+
705+
if( ( reportScratchSlots || !IsScratchStackSlot(spOffset, spBase, pRD) ) &&
706+
( !reportFpBasedSlotsOnly || (GC_FRAMEREG_REL == spBase ) ) )
703707
{
704708
ReportStackSlotToGC(
705709
spOffset,

src/coreclr/vm/exceptionhandling.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8254,6 +8254,17 @@ extern "C" bool QCALLTYPE SfiInit(StackFrameIterator* pThis, CONTEXT* pStackwalk
82548254
}
82558255
}
82568256
}
8257+
else // pass number 2
8258+
{
8259+
if (pThis->GetFrameState() == StackFrameIterator::SFITER_SKIPPED_FRAME_FUNCTION)
8260+
{
8261+
// Update context pointers using the skipped frame. This is needed when exception handling continues
8262+
// from ProcessCLRExceptionNew, since the RtlUnwind doesn't maintain context pointers.
8263+
Frame *pSkippedFrame = pThis->m_crawl.GetFrame();
8264+
_ASSERTE(pSkippedFrame->NeedsUpdateRegDisplay() && pSkippedFrame->GetReturnAddress() == GetControlPC(pThis->m_crawl.GetRegisterSet()));
8265+
pSkippedFrame->UpdateRegDisplay(pThis->m_crawl.GetRegisterSet());
8266+
}
8267+
}
82578268
StackWalkAction retVal = pThis->Next();
82588269
result = (retVal != SWA_FAILED);
82598270
}

src/coreclr/vm/gcenv.ee.common.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,6 @@ void GcEnumObject(LPVOID pData, OBJECTREF *pObj, uint32_t flags)
149149
Object ** ppObj = (Object **)pObj;
150150
GCCONTEXT * pCtx = (GCCONTEXT *) pData;
151151

152-
STRESS_LOG3(LF_GCROOTS, LL_INFO1000, "GcEnumObject at slot %p, object %p, pinned=%d\n", pObj, *ppObj, (flags & GC_CALL_PINNED) ? 1 : 0);
153-
154152
// Since we may be asynchronously walking another thread's stack,
155153
// check (frequently) for stack-buffer-overrun corruptions after
156154
// any long operation

src/coreclr/vm/gcinfodecoder.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -680,9 +680,7 @@ bool GcInfoDecoder::EnumerateLiveSlots(
680680
// previously visited a child funclet
681681
if (WantsReportOnlyLeaf() && (inputFlags & ParentOfFuncletStackFrame))
682682
{
683-
#ifndef NATIVEAOT
684-
STRESS_LOG0(LF_GCROOTS, LL_INFO100, "Not reporting this frame because it was already reported via another funclet.\n");
685-
#endif
683+
LOG((LF_GCROOTS, LL_INFO100000, "Not reporting this frame because it was already reported via another funclet.\n"));
686684
return true;
687685
}
688686

@@ -1512,13 +1510,6 @@ void GcInfoDecoder::ReportRegisterToGC( // AMD64
15121510
{
15131511
GCINFODECODER_CONTRACT;
15141512

1515-
#ifndef NATIVEAOT
1516-
if (flags & ReportFPBasedSlotsOnly)
1517-
{
1518-
return;
1519-
}
1520-
#endif
1521-
15221513
_ASSERTE(regNum >= 0 && regNum <= 16);
15231514
_ASSERTE(regNum != 4); // rsp
15241515

@@ -2214,13 +2205,6 @@ void GcInfoDecoder::ReportStackSlotToGC(
22142205
OBJECTREF* pObjRef = GetStackSlot(spOffset, spBase, pRD);
22152206
_ASSERTE(IS_ALIGNED(pObjRef, sizeof(OBJECTREF*)));
22162207

2217-
#ifndef NATIVEAOT
2218-
if ((flags & ReportFPBasedSlotsOnly) && (GC_FRAMEREG_REL != spBase))
2219-
{
2220-
return;
2221-
}
2222-
#endif
2223-
22242208
#ifdef _DEBUG
22252209
LOG((LF_GCROOTS, LL_INFO1000, /* Part One */
22262210
"Reporting %s" FMT_STK,

0 commit comments

Comments
 (0)