未验证 提交 40b09155 编写于 作者: D David Wrighton 提交者: GitHub

Fix dynamic pgo (#47790)

* Fix dynamic pgo schema data copy
上级 d138818b
......@@ -653,14 +653,8 @@ HRESULT PgoManager::ComputeOffsetOfActualInstrumentationData(const ICorJitInfo::
return E_NOTIMPL;
}
// Determine alignment of instrumentation data
UINT maxAlign = 0;
for (UINT32 iSchema = 0; iSchema < countSchemaItems; iSchema++)
{
maxAlign = max(InstrumentationKindToAlignment(pSchema[iSchema].InstrumentationKind), maxAlign);
}
*offsetOfActualInstrumentationData = (UINT)AlignUp(headerSize, maxAlign);
// Align all instrumentation at size_t alignment, as the copy routine will copy in size_t units
*offsetOfActualInstrumentationData = (UINT)AlignUp(headerSize, sizeof(size_t));
return S_OK;
}
......@@ -817,7 +811,6 @@ HRESULT PgoManager::getPgoInstrumentationResults(MethodDesc* pMD, BYTE** pAlloca
if (ReadInstrumentationSchemaWithLayoutIntoSArray(found->GetData(), found->countsOffset, found->countsOffset, &schemaArray))
{
EX_TRY
{
// TypeHandles can't reliably be loaded at ReadPGO time
......@@ -1054,17 +1047,17 @@ HRESULT PgoManager::getPgoInstrumentationResultsInstance(MethodDesc* pMD, BYTE**
}
StackSArray<ICorJitInfo::PgoInstrumentationSchema> schemaArray;
if (ReadInstrumentationSchemaWithLayoutIntoSArray(found->header.GetData(), found->header.countsOffset, found->header.countsOffset, &schemaArray))
if (ReadInstrumentationSchemaWithLayoutIntoSArray(found->header.GetData(), found->header.countsOffset, 0, &schemaArray))
{
size_t schemaDataSize = schemaArray.GetCount() * sizeof(ICorJitInfo::PgoInstrumentationSchema);
size_t schemaDataSize = AlignUp(schemaArray.GetCount() * sizeof(ICorJitInfo::PgoInstrumentationSchema), sizeof(size_t));
size_t instrumentationDataSize = 0;
if (schemaArray.GetCount() > 0)
{
auto lastSchema = schemaArray[schemaArray.GetCount() - 1];
instrumentationDataSize = lastSchema.Offset + lastSchema.Count * InstrumentationKindToSize(lastSchema.InstrumentationKind) - found->header.countsOffset;
instrumentationDataSize = AlignUp(lastSchema.Offset + lastSchema.Count * InstrumentationKindToSize(lastSchema.InstrumentationKind), sizeof(size_t));
}
*pAllocatedData = new BYTE[schemaDataSize + instrumentationDataSize];
*ppSchema = (ICorJitInfo::PgoInstrumentationSchema*)pAllocatedData;
*ppSchema = (ICorJitInfo::PgoInstrumentationSchema*)*pAllocatedData;
*pCountSchemaItems = schemaArray.GetCount();
memcpy(*pAllocatedData, schemaArray.OpenRawBuffer(), schemaDataSize);
schemaArray.CloseRawBuffer();
......
......@@ -966,6 +966,9 @@
<!-- Known failures for mono runtime on *all* architectures/operating systems -->
<ItemGroup Condition="'$(RuntimeFlavor)' == 'mono'" >
<ExcludeList Include="$(XunitTestBinBase)/JIT/Directed/DynamicPgo/**">
<Issue>Mono doesn't have a dynamic pgo or tiered compilation infrastructure</Issue>
</ExcludeList>
<ExcludeList Include="$(XunitTestBinBase)/JIT/SIMD/Vector3Interop_r/*">
<Issue>https://github.com/dotnet/runtime/issues/46174</Issue>
</ExcludeList>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册