Skip to content

Commit

Permalink
SPMI: Replay recorded allocPgoInstrumentationBySchema HRESULT (dotnet…
Browse files Browse the repository at this point in the history
…#101696)

Current SPMI collection has a recorded allocPgoInstrumentationBySchema
call that failed (EE returned 0x80004001). SPMI fails to replay that
correctly.

Fix dotnet#101685
  • Loading branch information
jakobbotsch authored and michaelgsharp committed May 8, 2024
1 parent 1630f4c commit 39f7495
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/coreclr/tools/superpmi/superpmi-shared/methodcontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5640,10 +5640,11 @@ HRESULT MethodContext::repAllocPgoInstrumentationBySchema(
UINT32 countSchemaItems,
BYTE** pInstrumentationData)
{
if (repAllocPgoInstrumentationBySchemaRecorded(ftnHnd, pSchema, countSchemaItems, pInstrumentationData))
HRESULT result;
if (repAllocPgoInstrumentationBySchemaRecorded(ftnHnd, pSchema, countSchemaItems, pInstrumentationData, &result))
{
// Matching case: return same layout as recorded EE.
return S_OK;
return result;
}

// Do our own layout.
Expand Down Expand Up @@ -5676,7 +5677,8 @@ bool MethodContext::repAllocPgoInstrumentationBySchemaRecorded(
CORINFO_METHOD_HANDLE ftnHnd,
ICorJitInfo::PgoInstrumentationSchema* pSchema,
UINT32 countSchemaItems,
BYTE** pInstrumentationData)
BYTE** pInstrumentationData,
HRESULT* result)
{
if (AllocPgoInstrumentationBySchema == nullptr)
return false;
Expand Down Expand Up @@ -5716,6 +5718,7 @@ bool MethodContext::repAllocPgoInstrumentationBySchemaRecorded(
// We assume JIT does not write or read from this buffer, only generate
// code that uses it.
*pInstrumentationData = (BYTE*)value.instrumentationDataAddress;
*result = value.result;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/superpmi/superpmi-shared/methodcontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ class MethodContext
void recAllocPgoInstrumentationBySchema(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, UINT32 countSchemaItems, BYTE** pInstrumentationData, HRESULT result);
void dmpAllocPgoInstrumentationBySchema(DWORDLONG key, const Agnostic_AllocPgoInstrumentationBySchema& value);
HRESULT repAllocPgoInstrumentationBySchema(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, UINT32 countSchemaItems, BYTE** pInstrumentationData);
bool repAllocPgoInstrumentationBySchemaRecorded(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, UINT32 countSchemaItems, BYTE** pInstrumentationData);
bool repAllocPgoInstrumentationBySchemaRecorded(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema* pSchema, UINT32 countSchemaItems, BYTE** pInstrumentationData, HRESULT* result);

void recGetPgoInstrumentationResults(CORINFO_METHOD_HANDLE ftnHnd, ICorJitInfo::PgoInstrumentationSchema** pSchema, UINT32* pCountSchemaItems, BYTE** pInstrumentationData, ICorJitInfo::PgoSource* pPgoSource, bool* pDynamicPgo, HRESULT result);
void dmpGetPgoInstrumentationResults(DWORDLONG key, const Agnostic_GetPgoInstrumentationResults& value);
Expand Down

0 comments on commit 39f7495

Please sign in to comment.