Skip to content

Commit

Permalink
Store last OSR transition context in static memory in DEBUG builds (d…
Browse files Browse the repository at this point in the history
…otnet#101537)

Hopefully will help with diagnosing dotnet#101060 once we get a new dump.
  • Loading branch information
jakobbotsch authored and matouskozak committed Apr 30, 2024
1 parent 85763ce commit 969fe48
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/coreclr/vm/jithelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5144,7 +5144,7 @@ void JIT_Patchpoint(int* counter, int ilOffset)
const int counterBump = g_pConfig->OSR_CounterBump();
*counter = counterBump;

#if _DEBUG
#ifdef _DEBUG
const int ppId = ppInfo->m_patchpointId;
#endif

Expand Down Expand Up @@ -5389,6 +5389,12 @@ void JIT_Patchpoint(int* counter, int ilOffset)
// Install new entry point as IP
SetIP(pFrameContext, osrMethodCode);

#ifdef _DEBUG
// Keep this context around to aid in debugging OSR transition problems
static CONTEXT s_lastOSRTransitionContext;
s_lastOSRTransitionContext = *pFrameContext;
#endif

// Restore last error (since call below does not return)
// END_PRESERVE_LAST_ERROR;
::SetLastError(dwLastError);
Expand Down Expand Up @@ -5425,7 +5431,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset)
// Patchpoint identity is the helper return address
PCODE ip = (PCODE)_ReturnAddress();

#if _DEBUG
#ifdef _DEBUG
// Friendly ID number
int ppId = 0;
#endif
Expand All @@ -5439,7 +5445,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset)
OnStackReplacementManager* manager = allocator->GetOnStackReplacementManager();
ppInfo = manager->GetPerPatchpointInfo(ip);

#if _DEBUG
#ifdef _DEBUG
ppId = ppInfo->m_patchpointId;
#endif

Expand Down

0 comments on commit 969fe48

Please sign in to comment.