Skip to content

Commit d75f0ee

Browse files
jakobbotschmichaelgsharp
authored andcommitted
Store last OSR transition context in static memory in DEBUG builds (dotnet#101537)
Hopefully will help with diagnosing dotnet#101060 once we get a new dump.
1 parent 8e39108 commit d75f0ee

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/coreclr/vm/jithelpers.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -5144,7 +5144,7 @@ void JIT_Patchpoint(int* counter, int ilOffset)
51445144
const int counterBump = g_pConfig->OSR_CounterBump();
51455145
*counter = counterBump;
51465146

5147-
#if _DEBUG
5147+
#ifdef _DEBUG
51485148
const int ppId = ppInfo->m_patchpointId;
51495149
#endif
51505150

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

5392+
#ifdef _DEBUG
5393+
// Keep this context around to aid in debugging OSR transition problems
5394+
static CONTEXT s_lastOSRTransitionContext;
5395+
s_lastOSRTransitionContext = *pFrameContext;
5396+
#endif
5397+
53925398
// Restore last error (since call below does not return)
53935399
// END_PRESERVE_LAST_ERROR;
53945400
::SetLastError(dwLastError);
@@ -5425,7 +5431,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset)
54255431
// Patchpoint identity is the helper return address
54265432
PCODE ip = (PCODE)_ReturnAddress();
54275433

5428-
#if _DEBUG
5434+
#ifdef _DEBUG
54295435
// Friendly ID number
54305436
int ppId = 0;
54315437
#endif
@@ -5439,7 +5445,7 @@ HCIMPL1(VOID, JIT_PartialCompilationPatchpoint, int ilOffset)
54395445
OnStackReplacementManager* manager = allocator->GetOnStackReplacementManager();
54405446
ppInfo = manager->GetPerPatchpointInfo(ip);
54415447

5442-
#if _DEBUG
5448+
#ifdef _DEBUG
54435449
ppId = ppInfo->m_patchpointId;
54445450
#endif
54455451

0 commit comments

Comments
 (0)